SOLVED: Need help with FileInfoReturn on a Mac
I've created a custom inventory rule where I'm using the FileInfoReturn function. I'm trying to pick up the last modified date on this file on a Mac:
/Users/Shared/Parallels/Microsoft Windows XP SP3.pvm
so my syntax is (all on one line, of course):
[font="courier new"]FileInfoReturn(/Users/Shared/Parallels/Microsoft Windows XP SP3.pvm,ModifiedDate,DATE)
And this is returning nothing on a machine where I know this file exists. Now, I don't work with Macs much, so I don't know whether the problem is in my syntax, or how FileInfoReturn works on Macs, or something else.
See, this file is one of those magic files on a Mac that is really a folder, where you can use the Show Package Contents menu item in the Mac OS X to see the files inside it. One of the files inside it is winxpsp3.hdd, but adding that to the path did not change the results: nothing.
Can anyone spot what I'm doing wrong? Sande
/Users/Shared/Parallels/Microsoft Windows XP SP3.pvm
so my syntax is (all on one line, of course):
[font="courier new"]
And this is returning nothing on a machine where I know this file exists. Now, I don't work with Macs much, so I don't know whether the problem is in my syntax, or how FileInfoReturn works on Macs, or something else.
See, this file is one of those magic files on a Mac that is really a folder, where you can use the Show Package Contents menu item in the Mac OS X to see the files inside it. One of the files inside it is winxpsp3.hdd, but adding that to the path did not change the results: nothing.
Can anyone spot what I'm doing wrong? Sande
0 Comments
[ + ] Show comments
Answers (3)
Please log in to answer
Posted by:
snissen
13 years ago
I found my own answer. (Sigh... I hate it when I do that.)
On UNIX-based operating systems like Mac OS X, instead of ModifiedDate, I need to use modification_time, like this:
[font="courier new"]FileInfoReturn(/Users/Shared/Parallels/Microsoft Windows XP SP3.pvm,modification_time,DATE)
So some of you may find this interesting: what I'm really trying to get into this field is the last modified date of any Virtual Machine (VM) on a computer, whether it's in Parallels or VMware on a Mac, or VMware or Windows Virtual PC under Windows. (I'm assuming the VM is in one of the locations where we always put these.)
So this command is working for all our machines, Macs and Windows:
[font="courier new"]FileInfoReturn(/Users/Shared/Parallels/Microsoft Windows XP SP3.pvm,modification_time,DATE) OR FileInfoReturn(C:\Virtual\WinXPSP3\WinXPSP3.vmx,ModifiedDate,DATE) OR [font="courier new"]FileInfoReturn(C:\ProgramData\Microsoft\Windows Virtual PC\Virtual Machines\Windows XP Mode.vmc,ModifiedDate,DATE)
Isn't that cool? And when more than one VM is found, the field content is:
[font="courier new"]2010-12-07 00:39:55 AND 2011-04-08 19:20:22
Now if I could only make the rule search the hard drive for the location of these .pvm, .vmx. and .vmc files... Sande
On UNIX-based operating systems like Mac OS X, instead of ModifiedDate, I need to use modification_time, like this:
[font="courier new"]
So some of you may find this interesting: what I'm really trying to get into this field is the last modified date of any Virtual Machine (VM) on a computer, whether it's in Parallels or VMware on a Mac, or VMware or Windows Virtual PC under Windows. (I'm assuming the VM is in one of the locations where we always put these.)
So this command is working for all our machines, Macs and Windows:
[font="courier new"]
Isn't that cool? And when more than one VM is found, the field content is:
[font="courier new"]
Now if I could only make the rule search the hard drive for the location of these .pvm, .vmx. and .vmc files... Sande
Posted by:
jkatkace
13 years ago
Posted by:
snissen
13 years ago
With K1000 version 5.1, I had many problems with the ShellCommand*Return functions on Windows machines. I could create and test command lines that worked perfectly on every Windows machine; plugged into ShellCommandTextReturn, the same commands never worked. The biggest problems seemed to be with special characters in the command line: & && || command conatenations, < > | redirection and piping. (And of course, command grouping with ( ) did not work at all.) KACE finally confirmed some bugs in this area, and promised fixes in version 5.2.
I haven't had a chance in version 5.2 to re-test all my attempts. The one I have re-tested still does not work.
BTW, for any of you looking for detailed information about exactly how all these cmd.exe command line tricks work, this is by far the best guide I've ever found: http://ss64.com/nt/syntax.html Sande
I haven't had a chance in version 5.2 to re-test all my attempts. The one I have re-tested still does not work.
BTW, for any of you looking for detailed information about exactly how all these cmd.exe command line tricks work, this is by far the best guide I've ever found: http://ss64.com/nt/syntax.html Sande
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.