I want to use machine.id variable in the vmx file to pass a string to the guest OS. My guest is running on ESX 3.5 Update 4. I am following the examples in some of the vmware pdfs (like the VMware Server User's Guide). I would like to use a powershell script to call the command and then assigned the returned text (in this case, IP address and subnet) to a variable. The end goal is to get the passed string, that has IP data separated by commas, into an array of text. The powershell command that seems to work is:
& 'C:\Program Files\VMware\VMware Tool\ls\VMwareService.exe' --cmd machine.id.get
This returns the following text in my powershell window:
192.168.11.250,255.255.255.0 C:\Scripts>
As you can see this is a IP address and subnet.What is odd about this is that the command prompt is on the same line as the text that was returned. The other strange thing, not sure if the two is related, is that when I assign this to a variable or pipe it to a file the contents of the variable or file is blank. I am not sure if this is a issue with powershell or how vmwareservice returns values. I have been able to assign the output of
other commands (dir, ls) to a variable or pipe to a file and it works fine. Thanks for you help.