Friday, December 16, 2011

For automating Snapshots

And here is another one for automating snapshots:

################
#
# snappy.ps1
# This will create snapshots of systems in a previously used CSV.
# You will need to setup some variables if desired
#
# Create by Ryan Kovar/16DEC2011
#################################
add-pssnapin VMware.VimAutomation.Core
#Your Vcenter or ESX host
$VIserver = "YOUR SERVER"

#Your list of systems
$vms = Import-CSV .\YOUR.CSV

#Name of the snapshot
$NAME = "SNAP"
##############################

Connect-VIserver $VIserver
foreach ($vm in $vms){
     #Stops all the VM's just incase they were started
     Stop-VM -VM (Get-VM -Name $vm.name) -Confirm:$false
     get-VM $vm.name | New-Snapshot -Name $NAME  
}

0 comments:

Post a Comment