
Last year I created a Windows PowerShell script for System Center Virtual Machine Manager which checks all the Virtual Machines for Snapshots and if you have any it will send you an E-Mail and it will remind you about that.
It were just some small changes from the SCVMM PowerShell cmdlets to the Windows Server 2012 PowerShell cmdlets.
# Get Snapshots
$snapshots = Get-VM | Get-VMSnapshot
# Check for existing Snapshots
if ($snapshots.count -gt 0){
# Create the List of Snapshots
$info = $snapshots | Format-Table VMName, Name -auto | Out-String
# Mail Configuration
# ==================
# Configuration
$emailFrom = "user@mydomain.com"
$emailTo = "user@yourdomain.com"
$emailSubject = "VM Snapshot Reminder"
$emailMessage = "You have still some snapshots: `n `n" + $info + "`n Greetings your Hyper-V Server"
$smtpServer = "mail.server.com"
$smtpUserName = "username" # This could be also in e-mail address format
$smtpPassword = "password"
$smtpDomain = ""
# SMTP Object
$smtp = New-Object System.Net.Mail.SmtpClient($smtpServer)
$mailCredentials = New-Object System.Net.NetworkCredential
$mailCredentials.Domain = $smtpDomain
$mailCredentials.UserName = $smtpUserName
$mailCredentials.Password = $smtpPassword
$smtp.Credentials = $mailCredentials
# Send E-Mail
$smtp.Send($emailFrom, $emailTo, $emailSubject, $emailMessage)
}









