VMWare - How to start a Virtual Machine automatically ?

Steps

After installing VMware Server, you can find this directory :

  • VMware_HOME\VMware VmPerl Scripting API\SampleScripts

This directory contains some sample code and this special script : startallvms.pl

This script start all VM with the parameter

autostart = "true"

in there configuration file.

To run the script, you can take example of the file vmware-cmd.bat which is located in the parent directory. For instance :

  setlocal
  set PATH=%PATH%;C:\Program Files\VMware\VMware VmPerl Scripting API
  "C:\Program Files\VMware\VMware VmPerl Scripting API\perl.exe" "C:\Program Files\VMware\VMware VmPerl Scripting API\SampleScripts\startallvms.pl"

If you install VMWare Server in a other disk, you must change the path in the startallvms.pl script. For instance with the disk D :

BEGIN {
   if ($^O eq "MSWin32") {
      @INC = (
         # Set the path to your VmPerl Scripting directory if different
         'D:\Program Files\VMware\VMware VmPerl Scripting API\perl5\site_perl\5.005',
         'D:\Program Files\VMware\VMware VmPerl Scripting API\perl5\site_perl\5.005\MSWin32-x86');
   }
}

Powered by ComboStrap