

| Start a VM using Powershell |
|
|
|
|
 I created this simple script to make sure all servers stay running when I go on vacation. It checks the power state and if the server is off it restarts it. Run this as a scheduled task to make sure a server or multiple servers are running.      -----Copy everything below this line----- # Created by Chey Harden 3.28.2011
Add-PSSnapin VMware.VimAutomation.Core
Connect-VIServer -Server vCENTERSERVERHERE -User LOGINNAMEHERE -Password PASSWORDHERE
$objState = Get-VM SERVERNAMEHERE | Select-Object PowerState If ($objState -match "ff") {Get-VM SERVERNAMEHERE | Start-VM}
$objState0 = Get-VM 2ndSERVERNAMEHERE | Select-Object PowerState If ($objState1 -match "ff") {Get-VM 2ndSERVERNAMEHERE | Start-VM}
-----Copy everything above this line-----
   This information is provided "AS IS" with no warranties expressed or implied.   Advertisements
|










