Create EP-CopyJob with Encryption

PowerShell script exchange

Create EP-CopyJob with Encryption

Veeam Logoby SRaring » Thu Aug 25, 2016 2:09 pm

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?
SRaring
Novice
 
Posts: 3
Liked: never
Joined: Fri Dec 12, 2014 7:07 am
Full Name: Sebastian Raring

Re: Create EP-CopyJob with Encryption

Veeam Logoby v.Eremin » Thu Aug 25, 2016 2:47 pm

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.
v.Eremin
Veeam Software
 
Posts: 13295
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Create EP-CopyJob with Encryption

Veeam Logoby SRaring » Wed Sep 07, 2016 10:06 am

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.
SRaring
Novice
 
Posts: 3
Liked: never
Joined: Fri Dec 12, 2014 7:07 am
Full Name: Sebastian Raring

Re: Create EP-CopyJob with Encryption

Veeam Logoby v.Eremin » Wed Sep 07, 2016 12:21 pm

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.
v.Eremin
Veeam Software
 
Posts: 13295
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: capedFef and 11 guests