PowerShell script exchange
Post Reply
liorme
Enthusiast
Posts: 41
Liked: 1 time
Joined: Mar 12, 2019 6:29 am
Full Name: lior
Contact:

assign specific proxies to all replica jobs

Post by liorme »

hi, i'm unfamiliar with veeam's shell
i have vmware backups and replication jobs

i have multiple proxies. i want to assign 2 specific proxies to all replication jobs (only replication jobs) at once
what's the correct syntax for that? thank you
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: assign specific proxies to all replica jobs

Post by oleg.feoktistov »

Hi,

First, you need to assign these 2 proxies with a discriminator. Something, that would distinguish them from other proxies.
For example, 'Replica Proxy' in Description field.
Then, using Set-VBRViReplicaJob cmdlet, you can construct something like this:

Code: Select all

$replicas = Get-VBRJob | Where-Object {$_.JobType -eq 'Replica'}
$replicaProxies = Get-VBRViProxy | Where-Object {$_.Description -match 'Replica Proxy'}
foreach ($replica in $replicas) {
    Set-VBRViReplicaJob -Job $replica -SourceProxy $replicaProxies -TargetProxy $replicaProxies
}
Just make sure that both proxies are suitable for Source and Target proxy roles simultaneously.
Check this page for more information on proxy selection.

Thanks,
Oleg
liorme
Enthusiast
Posts: 41
Liked: 1 time
Joined: Mar 12, 2019 6:29 am
Full Name: lior
Contact:

Re: assign specific proxies to all replica jobs

Post by liorme »

thank you. and what if i want to do the same for auto selection? both for source and destination proxies
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: assign specific proxies to all replica jobs

Post by oleg.feoktistov »

Hi,

Then use the code below:

Code: Select all

$replicas = Get-VBRJob | Where-Object {$_.JobType -eq 'Replica'}
foreach ($replica in $replicas) {
    $jobOptions = Get-VBRJobOptions -Job $replica
    $jobOptions.JobOptions.SourceProxyAutoDetect = $True
    $jobOptions.JobOptions.TargetProxyAutoDetect = $True 
    Set-VBRJobOptions -Job $replica -Options $jobOptions
}
Best regards,
Oleg
liorme
Enthusiast
Posts: 41
Liked: 1 time
Joined: Mar 12, 2019 6:29 am
Full Name: lior
Contact:

Re: assign specific proxies to all replica jobs

Post by liorme »

thank you very much
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests