# Create a list of servers to process $Servers = "server1 server2 server3" $ServerList = $Servers.Split(" ") # Now connect to virtual center Connect-VIServer -Server "vcserver" # Now revert the VM's to the "Default" snapshot foreach ($Server in $ServerList) { write-host "Processing " $Server # Retrieve snapshot properties $snap = Get-Snapshot -VM (Get-VM -Name $Server) -Name 'Default' Write-Host "Reverting snapshot from " $snap.Created # This is the action that reverting the VM to the "Default" snapshot Set-VM -VM $Server -Snapshot $snap -confirm:$false # Now update the VM's note in VC $DT = Get-Date $Message = "Restored default machine on " Set-VM -VM $Server -Description $Message $DT -confirm:$false }
Last Updated (Wednesday, 13 May 2009 09:10)