Commit ff3f2321 authored by Lonlone Lee's avatar Lonlone Lee

Added Delete Snapshots PowerCLI Script

parent ba8bbd56
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm
###############
# These are the values you should get from your webform
#
$snapMemory = $false
$snapQuiesce = $true
$emailAddr = 'postgrads-sysadm@lists.stanford.edu'
$fileName = 'C:\Temp\GetSnapshots.csv'
$vcName = 'pgvcenter.stanford.edu'
###############
Connect-VIServer -Server $vcName
Import-Csv -Path $fileName -UseCulture | %{
$VMName = $_.VM
$snapName = $_.Name
if ($VMName) {
Write-Host "VMName: $VMName"
$vm = Get-VM -Name $VMName
$snapshot = Get-Snapshot -VM $vm -Name $snapName
Remove-Snapshot -Snapshot $snapshot -Confirm $false
}
}
Disconnect-VIServer -Server $vcName
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment