I got this powershell script from the forums and it is working very well. But the only requirement I have is to get the Media pool name instead of the Media pool ID. Since I don't have much expertise on power shell scripting, I am posting this here to get your help on this.
Many thanks in advance.
Code: Select all
#Add Veeam Snap In
Add-PSSnapin -Name VeeamPSSnapIn
#Mail Server Variables
#$recipients = ""
$recipients = ""
$smtpServer = ""
$smtpFrom = ""
$smtpTo = "$recipients"
$messageSubject = "Tapes ready for offsite - amSI Backups"
#Message Variables
$message = New-Object System.Net.Mail.MailMessage $smtpfrom, $smtpto
$message.Subject = $messageSubject
$message.IsBodyHTML = $true
$Header = @"
<style>
BODY{font-family: Calibri; font-size: 11pt;}
TABLE {border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}
TH {border-width: 1px;padding: 6px;border-style: solid;border-color: black;background-color: #63C1ED;}
TD {border-width: 1px;padding: 3px;border-style: solid;border-color: black;}
</style>
"@
#Veeam Tape Variables
$x=(get-date).adddays(-7)
$tapes = Get-VBRTapeMedium | where {$_.LastWriteTime -gt $x} |select Name,LastWriteTime,ExpirationDate,MediaPoolId,Location |Sort-Object Name,ExpirationDate | ConvertTo-Html -Head $Header
#Message Body
$bodyline1 = "<DIV style=font-size:11pt;font-family:Calibri> <p>The following tapes are ready to be sent offsite. Please replace with free ones:<br><br></p></DIV>"
$message.Body= $bodyline1 + $tapes
#Send the Message
$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($message)