I’ve been doing some poking around with Veeam Backup & Replication PowerShell modules lately. I wrote a quick and dirty script that will allow me to email the license usage to myself when I need it.
The idea behind this is to place it on each Veeam Backup & Replication instance with a scheduled task that will run ever so often. As time goes on I’ll improve this. But, it beats spending money on the Veeam Service Provider Console. If you’re required to report your licensing to Veeam. Either this or VSPC is useful.
In the next section I’ll go through the script and explain what it does. I made an effort to make it as generic as possible so I can place it on any
Script
This script assumes you have an open relay available to send the email.
It Will provide a detailed report of the current licensing usage at that point in time. This includes all of the points used up from the license for the servers, workstations, Veeam Agents, etc. that are being backed up.
# Reporting Configuration
$ReportHost = $(Get-ComputerInfo -Property CsDNSHostName).CsDNSHostName
$ReportPath = ""
$ReportFile = "$(Get-Date -UFormat %Y-%m-%d) - $ReportHost - VBR License Report"
$ReportType = "html"
$FullReportPath = "$ReportPath$ReportFile.$ReportType"
# SMTP Configuration
$ToAddress = ""
$FromAddress = ""
$SMTPServer = ""
$SMTPPort = ""
If ((Get-ChildItem -Path $ReportPath -Force | Measure-Object).Count -eq 0)
{
Generate-VBRLicenseUsageReport -Path "$ReportPath$ReportFile" -Type $ReportType
$ReportBody = $(Get-Content -Path $FullReportPath -Raw)
Send-MailMessage -From $FromAddress -To $ToAddress -Subject $ReportFile -SmtpServer $SMTPServer -Port $SMTPPort -BodyAsHtml -Body $ReportBody
Remove-Item -Path $FullReportPath
} Else {
Send-MailMessage -From $FromAddress -To $ToAddress -Subject $ReportFile -SmtpServer $SMTPServer -Port $SMTPPort -BodyAsHtml -Body $ReportBody
Remove-Item -Path $FullReportPath
}