Solved

Enable encryption for all existing backup jobs using powershell


Userlevel 1

Hi guys,

 

I was wondering if it is possible to enable the encrypt option for all backup jobs using powershell. I already have created the encryption key/password. 

 

Your help would be appriciated.

 

icon

Best answer by Chris.Arceneaux 16 February 2022, 15:18

View original

10 comments

Userlevel 6
Badge +5

Hello,

 

This can be accomplished using the Set-VBRJobAdvancedStorageOptions cmdlet.

 

Prior to this change, I also recommend you read our documentation where it discusses this change in more detail:

 

https://helpcenter.veeam.com/docs/backup/vsphere/encryption_best_practices.html#encryption-for-existing-jobs

Userlevel 7
Badge +17

Please be aware that a new full backup is needed for all systems you activate encryption for. This can result in a huge amount of additional backup data.

Userlevel 7
Badge +20

Please be aware that a new full backup is needed for all systems you activate encryption for. This can result in a huge amount of additional backup data.

Came here to say this, this will be an active full, so if you’re using ReFS/XFS you won’t be benefiting from block cloning as efficiently until all of your old chains are replaced by the new chains.

I actually did a session on this with Rick Vanover a few weeks ago if it’s of interest:

 

Userlevel 7
Badge +17

Please be aware that a new full backup is needed for all systems you activate encryption for. This can result in a huge amount of additional backup data.

Came here to say this, this will be an active full, so if you’re using ReFS/XFS you won’t be benefiting from block cloning as efficiently until all of your old chains are replaced by the new chains.

I actually did a session on this with Rick Vanover a few weeks ago if it’s of interest:

 

Correct, I forgot to mention the active full and the consequences for ReFS/XFS. :sunglasses: Good that the whole community have a look at this.

Userlevel 1

Just an update,

 

I created a script to enable the encryption. I wanted to share with you guys

 

Disconnect-VBRServer
Connect-VBRServer -Server localhost

function Read-InputBoxDialog([string]$Message, [string]$WindowTitle, [string]$DefaultText)
{
    Add-Type -AssemblyName Microsoft.VisualBasic
    return [Microsoft.VisualBasic.Interaction]::InputBox($Message, $WindowTitle, $DefaultText)
}

$ekey = Get-VBREncryptionKey -Description "Name of the Encryption Key that you configured"

$jobname = Read-InputBoxDialog -Message "Please enter job name to enable encryption" -WindowTitle "Which Job"

$job = Get-VBRJob -Name $jobname
Set-VBRJobAdvancedStorageOptions -Job $job -EnableEncryption $True -EncryptionKey $ekey

Userlevel 7
Badge +20

Just an update,

 

I created a script to enable the encryption. I wanted to share with you guys

 

Disconnect-VBRServer
Connect-VBRServer -Server localhost

function Read-InputBoxDialog([string]$Message, [string]$WindowTitle, [string]$DefaultText)
{
    Add-Type -AssemblyName Microsoft.VisualBasic
    return [Microsoft.VisualBasic.Interaction]::InputBox($Message, $WindowTitle, $DefaultText)
}

$ekey = Get-VBREncryptionKey -Description "Name of the Encryption Key that you configured"

$jobname = Read-InputBoxDialog -Message "Please enter job name to enable encryption" -WindowTitle "Which Job"

$job = Get-VBRJob -Name $jobname
Set-VBRJobAdvancedStorageOptions -Job $job -EnableEncryption $True -EncryptionKey $ekey

Good work on the script, again I’d just echo that you’ve factored in the amount of time it’ll take to perform active full backups on all of your jobs and that you’ve got sufficient repository space is you carry this out on all jobs simultaneously, but this is certainly a fast way to achieve this.

Userlevel 7
Badge +17

Good work on the script, again I’d just echo that you’ve factored in the amount of time it’ll take to perform active full backups on all of your jobs and that you’ve got sufficient repository space is you carry this out on all jobs simultaneously, but this is certainly a fast way to achieve this.

You don’t have to enable encryption on all jobs at the same time.

So the active fulls are done at different days and it’s not that bad. :sunglasses:

Userlevel 1

Thank you for the script. Works great. Made a few changes to perform a bulk update.

Userlevel 6
Badge +2

Wow, this is great, thank you @ldasilva for sharing the great script.

Userlevel 7
Badge +8

Handy script, but if anyone is reading it be warned if your jobs all run the same day they will ALL do an active full and take up a lot of space. 

 

If your jobs are small, or you have lots of room this would be great. For myself I’ll do 1 here and there to not overload my repo. 

Comment