Thursday, January 10, 2008

VMware: Extracting info from VMX files

In order to get some information on the exact names of VMs and the VMDK files they have mapped, I created a dump of all .VMX files on the SAN and used the following sed script to extract some relevant data:

s/#!.*/Configuration:/p
s/displayName/ &/p
s/scsi.:.\.fileName/ &/p
s/sched.swap.derivedName/ &/p

The script can be run using the following command:
$  sed -n -f "sed_script" "config-list"

The result is:
Configuration:
displayName = "Service Desk 5.2"
scsi0:0.fileName = "Service Desk 5.2.vmdk"
sched.swap.derivedName = "/vmfs/volumes/46363464-80...

If you want, it can even be formatted in other ways:
s/displayName = \"\(.*\)\"/\n\1\n/p
s/scsi.:.\.fileName = \"\(.*\)\"/ \1/p
s/sched.swap.derivedName = \"\(.*\)\"/ \1/p

Resulting in:
Service Desk 5.2
Service Desk 5.2.vmdk
/vmfs/volumes/46363464-80...


1 comment:

Anonymous said...

Who knows where to download XRumer 5.0 Palladium?
Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!

Custom Search