I've been using the old magement API to exchange strings between host and virtual machines.
Now I'm looking at upgrading which means I can no longer use the old scripting API - so as a first step, I installed VIX 1.8.1 on my Server 1.0.9 and started experimenting with vmrun.
I'd like to set a guestinfo variable test to a certain value. If I translate the old API call to a vmware-run cmd, I'd do the following:
C:\Program Files (x86)\VMware\VMware VmPerl Scripting API>vmware-cmd "C:\Virtual Machines\MyVM\MyVM.vmx" setguestinfo test "test 123"
So, I figured with vmrun it would look as follows
C:\Program Files (x86)\VMware\VMware VIX>vmrun -T server1 writeVariable "c:\Virtual Machines\MyVM\MyVM.vmx" guestEnv test "test 123"
That returns
Error: Command requires valid user name and password for the guest OS
So I added -gu and -gp parameters
C:\Program Files (x86)\VMware\VMware VIX>vmrun -T server1
writeVariable "c:\Virtual Machines\MyVM\MyVM.vmx" guestEnv test "test
123" -gu vmlogin -gp vmpassword
But that returns the exact same error message. So I tried putting -gu and -gp before the path to the vmx file which returns
Error: The operation is not supported for the specified parameters
And now I'm stumped.. I'm pretty confident I want guestEnv and not runtimeConfig, and the login and password I provide has administrator privileges on the vm, so I don't see what could be wrong here.
@edit: I did some more testing.. it seems a bunch of operations don't work... setting / getting info does not, listing files or processes does not, whereas starting a program in the guest does work and power operations (start/stop/reset, etc) do work.
@edit2: I already have a server2 installation so I tried it there.. and those commands all pass. However, there seems to be a change in syntax because no matter what I write on the host, i cannot read it on the guest, and vice versa. guestinfo.keyname still seems to be required on the guest side, but regardless of whether I address the key with guestinfo.keyname or just keyname on the host, I get no value. Does anybody have a working sample for exchanging guest info between host and guest?
Here's the syntax I'm using on the server:
VMwareService.exe --cmd "info-get guestinfo.keyname"
And to set a variable
VMwareService.exe --cmd "info-set guestinfo.keyname keyvalue"
That syntax works fine in server 1.09