Archive for December 18, 2012

Pulling Guest OS information from offline VMWare Fusion VMs

December 18, 2012 1 comment

As a related task to my Boot Camp partition detection, I also wanted to see if I could get information on the OS running in VMWare Fusion VMs without the VM actually being up and running. After some poking, I saw that I could get information on running VMs by using the vmrun list command. However, there didn’t see to be a way to pull information on non-running VMs using VMWare Fusion 5’s vmrun command.

After some additional investigation, it looked like the data I wanted was stored in /Users/username_here/Library/Preferences/com.vmware.fusion.plist in the VMFavoritesListDefaults2 plist key. In that plist key, the information I wanted was stored in the guestOS dict. With that information, I was able to use grep and awk to pull just the OS information I wanted. The command I used was:

defaults read com.vmware.fusion VMFavoritesListDefaults2 | grep guestOS | awk '{print $3}' | sed 's/"//g' | sed 's/;//g'

When I did that against my own VMs, here’s the output I received.

Screen Shot 2012-12-18 at 1.37.24 PM

Note: One thing to be aware of is that OS X VMs will report their Darwin OS info.

Because this information is stored on a per-user basis, you would need to check each user account to pull the VMs associated with each account.

Categories: Mac OS X, Scripting, VMware
%d bloggers like this: