Using Windows task scheduler you can schedule power off and on events for guest systems running in VMware vCenter or a standalone ESXi host.

My steps:

  1. Create a basic task – give it a name and description (optional)
  2. Choose when you want this task to stat
  3. Select the start date and time
  4. Choose “Start a program”
  5. Choose the program you would like to run.  In this setup we will be running the following:
  6. C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -NonInteractive -File “C:\work\task\jermsmit.ps1”
    C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -NonInteractive -File "C:\work\task\jermsmit.ps1"


  7. Click Next, Select Yes when Task Scheduler prompts you
  8. On the Finish screen, click Finish  – You can open properties to set this to run unattended


The script I am now using does the following:

  1. Loads the VMware PowerCli modules to powershell
  2. Connects to Specified ESXi or vCenter Server
  3. Issues a stop to specific VM Guests
  4. Issues a start to the VM Guest

Script Example:

# 2015-04-22
# Power Off, Power On Powershell/PowerCli Script
# By: jermsmit - @jermsmit

#  Add all installed VMware cmdlests
Add-PSSnapin Vmware*

# Connects to Specified ESXi Server Host
Connect-VIServer -Server -User root -Password adfdssssf!

# Issue Stop to Virtual Machine Guest
# Example Forceful Stop: Stop-VM -VM "web" -Kill -Confirm:$false
Stop-VM -VM "torproxy" -Confirm:$false
Stop-VM -VM "minecraft-vanilla" -Confirm:$false
Stop-VM -VM "web" -Confirm:$false

# Sleeps for 60 Seconds
Start-Sleep -Seconds 60

# Issue Start to Virtual Machine Guest
Start-VM -VM "torproxy" -Confirm:$false
Start-VM -VM "minecraft-vanilla" -Confirm:$false
Start-VM -VM "web" -Confirm:$false


Use cases:

  1. Powering systems down to conserve energy (earth day initiative)
  2. Allow for systems with large workloads to have full system resources without contention during scheduled down periods of the systems that are offline.
  3. Quick restore of nonpersistant environments


Thanks for visiting – jermal