4 Days – 4 Uses for VMware VIX (vmrun)

Know what’s coming yet? No? Here are some wonderful VMware VIX things you can do while you think on it.

  1. Install VMware Tools
  2. Set IP
  3. Snapshots
  4. Reboot VM

These are all on one line. Note, the first two work, the second two at the time of this writing report “Error: Unknown error” (ESX in VIX 1.6.2 is still experimental, but I’ve an SR with these too)

Install VMware Tools

vmrun –T esx –h https://server/sdk –u user –p password –gu guestUser –gp guestPassword “[datastore] /vmfolder/vmname.vmx” installTools

Set IP

vmrun –T esx –h https://server/sdk –u user –p password –gu guestUser –gp guestPassword runProgramInGuest "[datastore] vm/vm.vmx" c:\windows\system32\netsh.exe int ip set address local static 192.168.15.25 255.255.255.0 192.168.15.1 1

Snapshots

vmrun –T esx –h https://server/sdk –u root –p pass snapshot “[datastore] vm/vm.vmx” test
vmrun –T esx –h https://server/sdk –u root –p pass deleteSnapshot “[datastore] vm/vm.vmx” test

Reboot VM

vmrun –T esx –h https://server/sdk –u someuser –p password reset “[datastore] vm/vm.vmx” soft

Let me know in the comments what you’re using VIX for.

9 thoughts on “4 Days – 4 Uses for VMware VIX (vmrun)

  • Resizing the guest hard disk is a great one, I'm working on a demo for this but feel free to “scoop” me.

    Changing guest DNS or route. Restarting DHCP. These are a few good things to run through if a machine mysteriously becomes unreachable.

    Defragmenting the guest hard disk on Windows.

    Lots of possibilities here and we're just getting started.

  • 1. Changing DNS & Routes, easy enough, both default routes as well as injecting static routes?
    2. Also easy enough.
    3. If you've got a demo, I'll post it, no problem. If you'd like I can play with it some to see how it all works, and post results. You tell me.

  • How do you cleanly shutdown a NT 4 guest? If you run vmrun with the stop-soft option it stays at the message that it's safe to power off. The stop-hard would do a cold power off which is not good for the OS.

  • How do you cleanly shutdown a NT 4 guest? If you run vmrun with the stop-soft option it stays at the message that it's safe to power off. The stop-hard would do a cold power off which is not good for the OS.

Comments are closed.