Powershell: Fix Orphaned Standby hosts after vCenter reboot!

vCenter’s Distributed Resource Scheduler (DRS) is by far one of my favorite features of VI2.5.  Distributed Power Management (DPM) is an experimental extension of DRS that will power down unneeded hosts, and wake them when needed again.  How cool it that!  The good news is, it works great.  The bad news is, in the current release there is a bit of a bug in DPM.

When vCenter is restarted it looses track of any hosts that it (DPM), or you (the VI admin) have put in a suspended state.  The suspended hosts show up in VC as “NotResponding”, and VC is no longer capable of waking them up.  The fix is to manually power them on… how aggravating.  I finally had some free time this morning so I threw together a quick PowerShell script to bridge the gap until VMware releases a production ready version of DPM.

This script was designed to run at startup on VC. The beauty here is there is zero customization required. Which means this solution is truely dynamic. No need to modify anything as your environment matures! To implement this in your environment, you will need both Powershell, and the VI Toolkit for Windows installed on VC.   Save the above localy on your VC Server, and Finally add it as a scheduled task like so:

  1. Start -> All Programs -> Accessories -> System Tools -> Scheduled Tasks
  2. Double click on “Add Scheduled Task” to launch the wizard.
  3. Click Next through the welcome screen.
  4. On the program selection menu select browse, and open “%windir%system32windowspowershellv1.0powershell.exe”.
  5. Name your task and select “When my Computer Starts” as the run time.
  6. Enter the username and password for an account that has at least read access on vCenter.
  7. Check the “Open Advanced Properties for this task when I click Finish.”, and click finish.
  8. In the Task tab, Change ‘Run:’ to read:

Powershell.exe -Command “& <Path to your script>WakeHost.ps1”


As you can see it’s all very straight forward. When VC is rebooted it will lose knowledge of all suspended hosts.  Therefore, we run a  startup script that wakes them all up.  After they’re powered on, DPM will put them back to sleep… problem solved!  If  you don’t wish to add PowerShell and the VI Toolkit to your VC.  You must run the script from a PC that is on the same subnet as the COS nic on your hosts.   I run an isolated COS that is only available from VC so that decision was made for me :D.


1 thought on “Powershell: Fix Orphaned Standby hosts after vCenter reboot!”

  1. Hi, Glenn,

    I work on DPM at VMware and I appreciate your
    use of DPM and the helpful script!! Please
    contact me so we can sort out the scenario(s)
    that lead to this problem and can make sure they
    get fixed in the fully-supported version.
    [Er, the fact that a host is in standby is
    supposed to be saved in the vc database!]

    -Cheers, Anne


Leave a Reply