PowerShell script exchange
remi.minnebo
Novice
Posts: 4 Liked: 2 times
Joined: Mar 09, 2018 2:23 pm
Full Name: Remi J. Minnebo
Contact:
Post
by remi.minnebo » Mar 09, 2018 2:52 pm
1 person likes this post
Hi,
I'm trying to make a new Backup job report that includes if encryption is enabled.
We've had issues with encryption being disabled in the past while we thought we'd enabled it.
How can I query this option via powershell and make it appear in the report that's being sent whenever the backup job succeds or fails?
Thanks a bunch!
remi.minnebo
Novice
Posts: 4 Liked: 2 times
Joined: Mar 09, 2018 2:23 pm
Full Name: Remi J. Minnebo
Contact:
Post
by remi.minnebo » Mar 09, 2018 3:18 pm
this post
I know that the type 'VBREncryptionOptions' will give me a boolean value that reflects the 'Encryption enabled' checkbox in advanced options.
So how do I select a job and query this VBREncryptionOptions via powershell, and add this to the notification mail after the job succeeds/fails.
remi.minnebo
Novice
Posts: 4 Liked: 2 times
Joined: Mar 09, 2018 2:23 pm
Full Name: Remi J. Minnebo
Contact:
Post
by remi.minnebo » Mar 09, 2018 3:35 pm
this post
I've figured out how to query the StorageEncryptionEnabled type:
$JobName= "*Copy to External Disk"
$Job = Get-VBRJob -name $JobName
$Options = $Job.GetOptions()
$Options.BackupStorageOptions.StorageEncryptionEnabled
Now all I have to figure out is how to add this to the email notification.
tdewin
Veeam Software
Posts: 1839 Liked: 661 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:
Post
by tdewin » Mar 09, 2018 6:16 pm
this post
You can just make your own email message via send-mailmessage:
https://ss64.com/ps/send-mailmessage.html
eg
Code: Select all
asnp veeampssnapin
$jobs = get-vbrjob
$report = @()
foreach($job in $jobs) {
$opt = $job.getoptions()
$report += New-Object -TypeName psobject -Property @{Name=$job.Name;"Encryption Enabled"=$opt.BackupStorageOptions.StorageEncryptionEnabled}
}
$html = ($report | ConvertTo-Html ) -join "`r`n"
Send-MailMessage -From "info@veeambackup.com" -to "user@veeambackup.com" -SmtpServer 192.168.1.14 -subject "Encryption Report" -Body $html -BodyAsHtml
you could schedule it as as a task via the windows scheduler so it sends you one report every day
remi.minnebo
Novice
Posts: 4 Liked: 2 times
Joined: Mar 09, 2018 2:23 pm
Full Name: Remi J. Minnebo
Contact:
Post
by remi.minnebo » Mar 14, 2018 12:09 pm
1 person likes this post
Great! That works like a charm.
Thanks alot tdewin!
albertwt
Veteran
Posts: 960 Liked: 55 times
Joined: Nov 05, 2009 12:24 pm
Location: Sydney, NSW
Contact:
Post
by albertwt » Dec 05, 2022 12:29 pm
1 person likes this post
Thank you @Timothy for sharing, it is still valid until now
--
/* Veeam software enthusiast user & supporter ! */
Users browsing this forum: No registered users and 2 guests