PowerShell script exchange
Post Reply
RubinCompServ
Service Provider
Posts: 259
Liked: 65 times
Joined: Mar 16, 2015 4:00 pm
Full Name: David Rubin
Contact:

Scripting a mass change to jobs

Post by RubinCompServ »

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
Vitaliy S.
VP, Product Management
Posts: 27055
Liked: 2710 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Scripting a mass change to jobs

Post by Vitaliy S. »

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.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Scripting a mass change to jobs

Post by veremin »

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.
RubinCompServ
Service Provider
Posts: 259
Liked: 65 times
Joined: Mar 16, 2015 4:00 pm
Full Name: David Rubin
Contact:

Re: Scripting a mass change to jobs

Post by RubinCompServ »

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
tsightler
VP, Product Management
Posts: 6009
Liked: 2843 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Scripting a mass change to jobs

Post by tsightler »

You are using Set-VBRJobAdvancedBackupOptions, I believe you should be using Set-VBRJobAdvancedStorageOptions.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Scripting a mass change to jobs

Post by veremin »

More information regarding the said commandlet and parameters it accepts can be found here; might be worth taking a look. Thanks.
RubinCompServ
Service Provider
Posts: 259
Liked: 65 times
Joined: Mar 16, 2015 4:00 pm
Full Name: David Rubin
Contact:

Re: Scripting a mass change to jobs

Post by RubinCompServ »

I can't believe I missed that multiple times. Thanks - once I used the right command, everything worked (whoda thunk it?).
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Scripting a mass change to jobs

Post by veremin »

You're welcome. Should other help be needed, don't hesitate to let us know. Thanks.
Post Reply

Who is online

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