Hi all,
Could someone help me with a script that would do this?
Regards
Tyler
Is this along the lines of what you are looking for ?
$snaps = Get-VM | Get-Snapshot Remove-Snapshot -Snapshot $snaps -Confirm:$false
$emailFrom = "from@somedomain.com"
$emailTo = "to@somedomain.com"
$subject = "All snapshots are removed"
$body = $snaps | select VM,Name,Created,SizeMB | ft -AutoSize | Out-String
$smtpServer = "smtpserver"
$smtp = new-object Net.Mail.SmtpClient($smtpServer) $smtp.Send($emailFrom, $emailTo, $subject, $body)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Is this along the lines of what you are looking for ?
$snaps = Get-VM | Get-Snapshot Remove-Snapshot -Snapshot $snaps -Confirm:$false
$emailFrom = "from@somedomain.com"
$emailTo = "to@somedomain.com"
$subject = "All snapshots are removed"
$body = $snaps | select VM,Name,Created,SizeMB | ft -AutoSize | Out-String
$smtpServer = "smtpserver"
$smtp = new-object Net.Mail.SmtpClient($smtpServer) $smtp.Send($emailFrom, $emailTo, $subject, $body)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Luc,
Exactly what i was looking for.
SuperDuper thanks!!
Regards
Tyler