PowerShell script exchange
Post Reply
SRaring
Novice
Posts: 3
Liked: never
Joined: Dec 12, 2014 7:07 am
Full Name: Sebastian Raring
Contact:

Create EP-CopyJob with Encryption

Post by SRaring »

We save our Endpoint-Backups in a B&R-Repository and once a month we copy with a CopyJob the current backup of every physical computer from there to an external drive.
The EP-CopyJob only copies backups, if the last one is not older than 2 days (?). Is there a setting to change this?
Physical desktop computers are not running 24/7 at our place, so there is no current backup available from a pc if the colleague is at vacation.
The not perfect solution was to dynamically create a new Endpoint-CopyJob with only the EP-Jobs that where successfully running in the last 24 h. This works, but the encryption is not enabled, even if I set it. Via PS it looks like it is set, but not via GUI. The result is an unencrypted vbk.

An extract of the PS:

Code: Select all

$EP_Repository = Get-VBRBackupRepository -Name $repository_Extern
Add-VBREpBackupCopyJob -Name $jobname_Extern -Backup $EP_BackupJobs_OK -DirectOperation -Repository $EP_repository
$EP_Key = Get-VBREncryptionKey -Description $EP_KeyName;
if (!$EP_Key)
{
    exit 14;
}
$copyjobs | Set-VBRJobAdvancedStorageOptions -EnableEncryption $true -EncryptionKey $EP_Key;
The $EP_Key seems OK, because the debugger not running to "exit 14".
Is there an error in my script to enable the encryption?
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Create EP-CopyJob with Encryption

Post by veremin »

Just checked the script, everything seems to have worked successfully in my environment - the job was created as expected and the corresponding key was set and visible in both PS and GUI:

Code: Select all

asnp VeeamPSSNapin
$Repository = Get-VBRBackupRepository -name "Name of my repository"
$Backup = Get-VBRBackup | ?{$_.JobType -eq "EndpointBackup"}
Add-VBREpBackupCopyJob -Backup $Backup -Name "EP Backup Copy Job 1" -Repository $Repository -DirectOperation
$Job = Get-VBRJob -Name "EP Backup Copy Job 1"
$Job | Set-VBRJobAdvancedStorageOptions -EnableEncryption:$true -EncryptionKey (Get-VBREncryptionKey -Description "Description of my password")
Thanks.
SRaring
Novice
Posts: 3
Liked: never
Joined: Dec 12, 2014 7:07 am
Full Name: Sebastian Raring
Contact:

Re: Create EP-CopyJob with Encryption

Post by SRaring »

Many thanks for your test.

I found the error in my script. There was a mix of lines, because of a later change. My variable $copyjobs was set after it was used. I usally programming in languages like C++, where the compiler raise an error in such cases.
Sometimes it is better to have a fresh look on the problem another day. :)
Sorry, that I missed that. Now it works fine.
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Create EP-CopyJob with Encryption

Post by veremin »

You're welcome. Sometimes all you need to make everything work is a fresh pair of eyes. :) Glad to hear my input has been helpful. Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests