Scripting a mass change to jobs

PowerShell script exchange

Scripting a mass change to jobs

Veeam Logoby RubinCompServ » Mon Dec 14, 2015 7:54 pm

My environment has more than 100 different backup jobs. As part of a new compliance initiative, all of those jobs will need to be encrypted. Doesn't anyone know of a SQL script that can make that type of change to all of the jobs at once (it is okay if all use the same encryption key), or can point me in the right direction? I have some familiarity with the VeeamBackup database and its tables, but I'm not comfortable enough with the various relationships to write a script that can make changes.

Thanks,
RCS
RubinCompServ
Service Provider
 
Posts: 28
Liked: 5 times
Joined: Mon Mar 16, 2015 4:00 pm
Full Name: David Rubin

Re: Scripting a mass change to jobs

Veeam Logoby Vitaliy S. » Mon Dec 14, 2015 8:58 pm

There is no need to use SQL script, making direct changes to our database is unsupported. You goal should be easy to achieve via PowerShell API > Set-VBRJobAdvancedStorageOptions and Discussion on blog post: Update 2 featuring PowerShell.

Vladimir, our PowerShell guru can assist you further if needed.
Vitaliy S.
Veeam Software
 
Posts: 19558
Liked: 1102 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: Scripting a mass change to jobs

Veeam Logoby v.Eremin » Tue Dec 15, 2015 7:55 am

You should get a list of required jobs, using Get-VBRJob commandlet, pass the resulting list to Set-VBRJobAdvancedStorageOptions commandlet to enable encryption (-EnableEncryption $True) and set required password (-EncryptionKey <PSCryptoKey>).

And don't forget to run a full backup in order for the newly specified settings to take place. (Start-VBRJob -Job $Job -FullBackup)

Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Scripting a mass change to jobs

Veeam Logoby RubinCompServ » Mon Dec 28, 2015 7:23 pm

Set-VBRJobAdvancedStorageOptions does not seem to accept EnableEncryption, even though it is listed as a parameter. I've used the GUI to create a key called "testkey" and tried to run the following script:

Code: Select all
Add-PSSnapin -Name VeeamPSSnapIn

$Job = Get-VBRJob -Name "test"
$Key = Get-VBREncryptionKey -Description "testkey"

Set-VBRJobAdvancedBackupOptions -Job $Job -EnableEncryption $TRUE -EncryptionKey $Key


And this is the output:

Code: Select all
Set-VBRJobAdvancedBackupOptions : A parameter cannot be found that matches parameter name 'EnableEncryption'.
At line:7 char:43
+ Set-VBRJobAdvancedBackupOptions -Job $Job -EnableEncryption $TRUE -EncryptionKey ...
+                                           ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-VBRJobAdvancedBackupOptions], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Veeam.Backup.PowerShell.Command.SetVBRJobAdvancedBackupOptions
RubinCompServ
Service Provider
 
Posts: 28
Liked: 5 times
Joined: Mon Mar 16, 2015 4:00 pm
Full Name: David Rubin

Re: Scripting a mass change to jobs

Veeam Logoby tsightler » Mon Dec 28, 2015 8:23 pm

You are using Set-VBRJobAdvancedBackupOptions, I believe you should be using Set-VBRJobAdvancedStorageOptions.
tsightler
Veeam Software
 
Posts: 4768
Liked: 1737 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Scripting a mass change to jobs

Veeam Logoby v.Eremin » Mon Dec 28, 2015 9:56 pm

More information regarding the said commandlet and parameters it accepts can be found here; might be worth taking a look. Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Scripting a mass change to jobs

Veeam Logoby RubinCompServ » Tue Dec 29, 2015 7:18 pm

I can't believe I missed that multiple times. Thanks - once I used the right command, everything worked (whoda thunk it?).
RubinCompServ
Service Provider
 
Posts: 28
Liked: 5 times
Joined: Mon Mar 16, 2015 4:00 pm
Full Name: David Rubin

Re: Scripting a mass change to jobs

Veeam Logoby v.Eremin » Wed Dec 30, 2015 11:41 am

You're welcome. Should other help be needed, don't hesitate to let us know. Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 6 guests