PowerShell script exchange
Post Reply
nd39475
Enthusiast
Posts: 29
Liked: 2 times
Joined: May 05, 2016 6:28 pm
Full Name: n d
Contact:

Problems with Add-VBRCopyJob

Post by nd39475 » Sep 19, 2019 1:45 pm

does this sound familiar? i searched the subject first and found other threads.

i want to iterate all my jobs and create copy-jobs based on them, but run into issue right off the bat. Add-VBRCopyJob has a -Type parameter of which i expect to accept "BackupSync", because that is what Get-VBRJob reported to me on a test-copy-job. However it does not. Additionally, the reference document reports that the "Backup" type is "not supported (legacy mode)". So how can this cmdlet even be used?

Furthermore why do Veaam powershell cmdlets not have the -WhatIf parameter?

This, (Veeam cmdlets), could be a god-send, but each and every time i get into a session i'm presented with more weird issues than i'd expect. I've used Powershell for AD and Powershell for VMware with much less aggravation. just IMHO. thanks for the rant relief.

jhoughes
Veeam Software
Posts: 107
Liked: 26 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Austin, TX
Contact:

Re: Problems with Add-VBRCopyJob

Post by jhoughes » Sep 19, 2019 1:50 pm 1 person likes this post

You should be using either Add-VBRViBackupCopyJob or Add-VBRHvBackupCopyJob, depending on which type of environment you have.
Husband, Father, Solutions Architect, Geek Extraordinaire | @AustinVMUG & @ATXPowerShell leader | vExpert | Cisco Champion | Tech Field Day Delegate | VCP 4/5/6 | VCP6-NV | VMware/Cisco UCS/Powershell/VEEAM Enthusiast

nd39475
Enthusiast
Posts: 29
Liked: 2 times
Joined: May 05, 2016 6:28 pm
Full Name: n d
Contact:

Re: Problems with Add-VBRCopyJob

Post by nd39475 » Sep 19, 2019 4:03 pm

wow, thank you. world of difference! i guess apologies are in order ;P

jhoughes
Veeam Software
Posts: 107
Liked: 26 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Austin, TX
Contact:

Re: Problems with Add-VBRCopyJob

Post by jhoughes » Sep 19, 2019 5:19 pm

No worries, I'll check if we should move it to the obsolete cmdlets within the documentation.
Husband, Father, Solutions Architect, Geek Extraordinaire | @AustinVMUG & @ATXPowerShell leader | vExpert | Cisco Champion | Tech Field Day Delegate | VCP 4/5/6 | VCP6-NV | VMware/Cisco UCS/Powershell/VEEAM Enthusiast

nd39475
Enthusiast
Posts: 29
Liked: 2 times
Joined: May 05, 2016 6:28 pm
Full Name: n d
Contact:

Re: Problems with Add-VBRCopyJob

Post by nd39475 » Sep 19, 2019 8:10 pm

Well i got it good enough for me, but not perfect, i tried getting some advanced schedules working, but gave up.

My simplified script is as follows just to get the jobs running with simplerestorepoints. i can do the rest manually via GUI.

Code: Select all

Add-PSSnapin VeeamPSSnapIn
$Testing = $true

Disconnect-VBRServer
Connect-VBRServer -server "veeam-serv" -port 9392

$TargetVeeamRepo = "Library BackupRepo 62TB"

$jobs = ( Get-VBRJob | Where-Object {$_.Name -notlike "*Library*" -and $_.Name -notlike "*Off*Campus*" -and $_.Name -notlike "*Copy*"} | Sort-Object -Property Name)
#$jobs = ( Get-VBRJob | Where-Object {$_.Name -eq "TESTJob"} | Sort-Object -Property Name)

foreach ($job in $jobs) {
  $jName = $job.Name
  $NewCopyJobName = "Library2 $jName BackupCopy"
  Write-Host "Job: $jName --> $NewCopyJobName"
  If (!$testing) {
    Write-Host "Adding: BackupCopyJob named `"$NewCopyJobName`" to `"$TargetVeeamRepo`"."
    Add-VBRViBackupCopyJob -DirectOperation -Name "$NewCopyJobName" -Backup "$jName" -Repository "$TargetVeeamRepo"
    
    $copyJob = Get-VBRJob -Name "$NewCopyJobName"
    $Options = $copyJob.GetOptions()
    $Options.GenerationPolicy.SimpleRetentionRestorePoints = 61
    Set-VBRJobOptions -Job "$NewCopyJobName" -Options $Options
  } else {
    Write-Host "Testing: Nothing being done for: BackupCopyJob named `"$NewCopyJobName`". Set`$Testing=`$false for action."
  }

}

veremin
Product Manager
Posts: 16867
Liked: 1429 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Problems with Add-VBRCopyJob

Post by veremin » Sep 23, 2019 5:26 pm

nd39475 wrote:Well i got it good enough for me, but not perfect, i tried getting some advanced schedules working, but gave up.
Can you tell me what exact settings you're struggling with? Chances are, they can be easily changed (via get/setoptions()) after job creation. Thanks!

nd39475
Enthusiast
Posts: 29
Liked: 2 times
Joined: May 05, 2016 6:28 pm
Full Name: n d
Contact:

Re: Problems with Add-VBRCopyJob

Post by nd39475 » Sep 23, 2019 6:13 pm

i wanted to set target's periodical fulls as follows:

Code: Select all

[✓] Keep the following restore points as full backups for archival purposes
  Weekly backup: [0]
  Monthly backup [1]
TY

veremin
Product Manager
Posts: 16867
Liked: 1429 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Problems with Add-VBRCopyJob

Post by veremin » Sep 23, 2019 6:19 pm

Check the GenerationPolicy set of options of the already created jobs. It should have everything you need (the parameter names are self-explanatory). Thanks!

nd39475
Enthusiast
Posts: 29
Liked: 2 times
Joined: May 05, 2016 6:28 pm
Full Name: n d
Contact:

Re: Problems with Add-VBRCopyJob

Post by nd39475 » Sep 23, 2019 7:05 pm

Thank you so much!

Post Reply

Who is online

Users browsing this forum: oleg.feoktistov and 6 guests