PowerShell script exchange
Post Reply
ipro-bgardner
Influencer
Posts: 10
Liked: 3 times
Joined: May 07, 2021 4:43 pm
Full Name: Brent Gardner
Contact:

Get encryption key for specific job

Post by ipro-bgardner »

Trying to audit encryption settings on our backup and offsite-copy jobs.
Sadly, looks like there's no Get-VBRJobAdvancedStorageOptions cmdlet.
How can I determine which encryption key is being used by a specific job?
I'd rather not have to click through tens of jobs to get this from the GUI.
Of course, I'm not looking for the actual secure string. But if I could get the ID then I could cross-reference with output from Get-VBREncryptionKey to get the human-meaningful description.

Regards,
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get encryption key for specific job

Post by oleg.feoktistov » 1 person likes this post

Hi Brent,

You can easily get the id of the encryption key being used in a job with the following code:

Code: Select all

$job = Get-VBRJob -Name 'Backup Job' 
$job.UserCryptoKey.Id

Thanks,
Oleg
ipro-bgardner
Influencer
Posts: 10
Liked: 3 times
Joined: May 07, 2021 4:43 pm
Full Name: Brent Gardner
Contact:

Re: Get encryption key for specific job

Post by ipro-bgardner »

Works beautifully.

I was using Get-VBRComputerBackupJob as my starting point, which doesn't have the UserCryptoKey property.

Thanks!
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get encryption key for specific job

Post by oleg.feoktistov »

I see no problems with Get-VBRComputerBackupJob either. It's just that the object structure is a bit different here:

Code: Select all

$job = Get-VBRComputerBackupJob -Name 'Linux Backup'
$job.StorageOptions.EncryptionKey.Id 
I would advise using Get-VBRComputerBackupJob cmdlet in your case as Get-VBRJob doesn't support agent management jobs.

Thanks,
Oleg
ipro-bgardner
Influencer
Posts: 10
Liked: 3 times
Joined: May 07, 2021 4:43 pm
Full Name: Brent Gardner
Contact:

Re: Get encryption key for specific job

Post by ipro-bgardner » 1 person likes this post

Nice.

Simpler code, faster, and I don't get warnings about Get-VBRJob and computer backup jobs.

Regards,
Brent
albertwt
Veteran
Posts: 879
Liked: 46 times
Joined: Nov 05, 2009 12:24 pm
Location: Sydney, NSW
Contact:

Re: Get encryption key for specific job

Post by albertwt »

oleg.feoktistov wrote: May 07, 2021 5:17 pm Hi Brent,

You can easily get the id of the encryption key being used in a job with the following code:

Code: Select all

$job = Get-VBRJob -Name 'Backup Job' 
$job.UserCryptoKey.Id

Thanks,
Oleg
Hi @Oleg,

In the script:

Code: Select all

$AllBackupJobs = Get-VBRJob | Where-Object { $_.TypeToString -eq 'VMware Backup' }

ForEach($BackupJob in $AllBackupJobs) {
    $BackupJob.GetJobDisplayName()
    $BackupJob.UserCryptoKey
    $BackupJob.UserCryptoKey.Id
}
Can we say that if the values of the $BackupJob.UserCryptoKey or $BackupJob.UserCryptoKey.Id value is empty, then the backup is not encrypted, but when any of those two has a value, then it is successfully encrypted ?
--
/* Veeam software enthusiast user & supporter ! */
Mildur
Product Manager
Posts: 8678
Liked: 2276 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Get encryption key for specific job

Post by Mildur » 1 person likes this post

Better check for StorageEncryptionEnabled as explained in your other topic about the same question.
Please don‘t use 4 topics to solve one issue. :)
then the backup is not encrypted, but when any of those two has a value, then it is successfully encrypted
The backup job may have encryption enabled, but that doesn‘t mean your backups are already encrypted.
If you change the settings for existing jobs, an active full is required before the backups are encrypted.

Thanks
Fabian
Product Management Analyst @ Veeam Software
albertwt
Veteran
Posts: 879
Liked: 46 times
Joined: Nov 05, 2009 12:24 pm
Location: Sydney, NSW
Contact:

Re: Get encryption key for specific job

Post by albertwt »

Hi @Mildur,

yes, I can now get the status correctly using the StorageEncryptionEnabled property.

Thank you for the pointer to this.
--
/* Veeam software enthusiast user & supporter ! */
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests