As a demonstration of the power of VIX, I’ve chosen to show you how to change IP addresses of a Windows VM. You may want to buckle up for this.
First, grab the VIX API installable from VMware’s site. In this case we’ll be using the Windows version (because that is the VM I happen to be writing this post from). The install is quick and puts all the files into “%PROGRAMFILES%\VMware\VMware VIX”.
Cool, now lets check the IP of our Windows VM:
Now, lets change it:
C:\Program Files\VMware\VMware VIX>vmrun -T esx -h https://esx.example.com/sdk -u nerv\cody.bunch -p apassword -gu Administrator -gp anotherpassword runProgramInGuest “[sanstorage1] test/test.vmx” c:\windows\system32\netsh int ip set address “Local Area Connection” static 192.168.15.25 255.255.255.0 192.168.15.1
(That is all one line, the blog wrapped it)
Now for the lovely error!
Not rightly sure on that one. I’ve opened an SR for it. We’ll see how it goes.