G
Gr8Britton
I followed examples online of how to use powershell to send an email. I want to setup a scheduled task to run the script when the Windows Server Backup runs so we know the result. The emails sends fine. The only problem is it will not display the results of the Get-WBJob line. Instead, it sends "Microsoft.Windows.ServerBackup.Commands.WBJob". Here is the script I'm using:
$Content = Get-WBJob -Previous 1
$Content
$emailSmtpServer = "[SMTP Server Address]"
$emailFrom = "IT Support <ITSupport@[Domain Name]>"
$emailTo = "[Recipient Email]"
$emailSubject = $env:computername+" Backup Succesful: "+(Get-Date)
$emailBody = $Content
Send-MailMessage -To $emailTo -From $emailFrom -Subject $emailSubject -Body $emailBody -SmtpServer $emailSmtpServer
At the console, $Content displays all of the data re: the last backup job. However, the email body displays "Microsoft.Windows.ServerBackup.Commands.WBJob".
Any suggestions?
Continue reading...
$Content = Get-WBJob -Previous 1
$Content
$emailSmtpServer = "[SMTP Server Address]"
$emailFrom = "IT Support <ITSupport@[Domain Name]>"
$emailTo = "[Recipient Email]"
$emailSubject = $env:computername+" Backup Succesful: "+(Get-Date)
$emailBody = $Content
Send-MailMessage -To $emailTo -From $emailFrom -Subject $emailSubject -Body $emailBody -SmtpServer $emailSmtpServer
At the console, $Content displays all of the data re: the last backup job. However, the email body displays "Microsoft.Windows.ServerBackup.Commands.WBJob".
Any suggestions?
Continue reading...