PowerShell script exchange
Post Reply
remi.minnebo
Novice
Posts: 4
Liked: 2 times
Joined: Mar 09, 2018 2:23 pm
Full Name: Remi J. Minnebo
Contact:

Encryption enabled notification?

Post by remi.minnebo » 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. :evil:

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:

Re: Encryption enabled notification?

Post by remi.minnebo »

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:

Re: Encryption enabled notification?

Post by remi.minnebo »

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: 1818
Liked: 655 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: Encryption enabled notification?

Post by tdewin »

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:

Re: Encryption enabled notification?

Post by remi.minnebo » 1 person likes this post

Great! That works like a charm.

Thanks alot tdewin! :)
albertwt
Veteran
Posts: 941
Liked: 53 times
Joined: Nov 05, 2009 12:24 pm
Location: Sydney, NSW
Contact:

Re: Encryption enabled notification?

Post by albertwt » 1 person likes this post

Thank you @Timothy for sharing, it is still valid until now :-)
--
/* Veeam software enthusiast user & supporter ! */
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 15 guests