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.