Translate this

    Translate to:

The back catalog

VMware-CMD Snippets

In the past I’ve had issues using the GSX Console via RDP (don’t ask why) and found vmware-cmd to be useful. So here are some examples of using vmware-cmd. The VMware-cmd version that comes with GSX/Server has an option for listing the registered VMs on a host (vmware-cmd -l).

ex:

C:>for /F "delims=|" %I in ('vmware-cmd -l') Do  echo %I
C:>echo G:\Virtual Machines\TstNTAppSvr999T\stNTAppSvr999.vmx
G:\Virtual Machines\TstNTAppSvr999\TstNTAppSvr999.vmx

C:>echo G:\Virtual Machines\DC3\DC3.vmx
G:\Virtual Machines\DC3\DC3.vmx

C:>echo G:\Virtual Machines\TestDC3\TESTDC3.vmx
G:\Virtual Machines\TestDC3\TESTDC3.vmx

C:>echo C:\Virtual Machines\APPSVR05\winNetStandard.vmx
C:\Virtual Machines\APPSVR05\winNetStandard.vmx

You can also use this with a for loop at the command line to perform tasks on all the VMs at once. Here are some examples.

  • Get the power state of all machines: for /F “delims=|” %I in (’vmware-cmd -l’) Do vmware-cmd “%I” getstate
  • Get Process ID (PID) for running VMs (good for trying to figure out who’s hogging the CPU): for /F “delims=|” %I in (’vmware-cmd -l’) Do vmware-cmd “%I” getpid
  • Stop All VMs: for /F “delims=|” %I in (’vmware-cmd -l’) Do vmware-cmd “%I” setconfig stop
  • Start All Registered VMs: for /F “delims=|” %I in (’vmware-cmd -l’) Do vmware-cmd “%I” setconfig start
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Posterous
  • Google Bookmarks
  • LinkedIn
  • Twitter