September 28, 2022 at 3:46 pm
$msg = Get-Content 'C:\miscjunk\SQL_Servers.txt' |
ForEach-Object {New-Object 'Microsoft.SqlServer.Management.Smo.Server' $_} |
Select-Object -Expand Databases |
Select-Object Name,
@{n='LastBackupDate';e={if ($_.LastBackupDate -eq '01/01/0001 00:00:00') {'NA'} else {$_.LastBackupDate}}}|
#@{n='LastDifferentialBackupDate';e={if ($_.RecoveryModel -eq 'Simple' -or $_.LastDifferentialBackupDate -eq '01/01/0001 00:00:00') {'NA'} else {$_.LastDifferentialBackupDate}}}
#@{n='LastLogBackupDate';e={if ($_.RecoveryModel -eq 'Simple' -or $_.LastLogBackupDate -eq '01/01/0001 00:00:00') {'NA'} else {$_.LastLogBackupDate}}} |
ConvertTo-Html -Head $style | Out-String
Send-MailMessage -From $emailFrom -To $emailTo -Subject $subject -Body $msg -BodyAsHtml -SmtpServer $smtpServer
I would like to add which server, and results of backup success\failure, and run duration. Can this be incorporated with what I have .. what do I need to add?
Thanks.
September 29, 2022 at 4:10 pm
Thanks for posting your issue and hopefully someone will answer soon.
This is an automated bump to increase visibility of your question.
October 3, 2022 at 1:00 pm
Any help on this request... I tried to goggle but didn't see examples...
Thanks.
October 4, 2022 at 8:22 pm
Any help on this request... I tried to goggle but didn't see examples...
Thanks.
I think the problem is that people doubt your claim. Case in point...
https://www.google.com/search?q=Get+backup+status+for+multiple+sql+servers+using+powershell
--Jeff Moden
Change is inevitable... Change for the better is not.
October 17, 2022 at 7:11 pm
I looked thru a lot of those articles and didn't see backup success\failure, and run duration within a P/S script.
Thanks
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy