Set-VBRJobProxy - Multiple Proxies

PowerShell script exchange

Set-VBRJobProxy - Multiple Proxies

Veeam Logoby kefoster » Thu Oct 01, 2015 3:51 pm

I want to specify multiple proxies for specific jobs via powershell. It appears Set-VBRJobProxy can only set a single proxy to a Job. Is there a way around this? Any examples would be great.

Thank you,

Kevin
kefoster
Novice
 
Posts: 8
Liked: 2 times
Joined: Thu Jun 21, 2012 7:34 pm
Full Name: Kevin Foster

Re: Set-VBRJobProxy - Multiple Proxies

Veeam Logoby v.Eremin » Thu Oct 01, 2015 3:59 pm

Proxy (-Proxy) parameter of the said commandlet accepts multiple proxy entities, so, setting array of proxies should work without any issues, like:

Code: Select all
Set-VBRJobProxy -Job $Job -Proxy $Proxies


If that doesn't happen, can you please post a code you're trying to execute?

Thanks.
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Set-VBRJobProxy - Multiple Proxies

Veeam Logoby kefoster » Thu Oct 01, 2015 4:10 pm

I thought the same thing but when I run the following code I get the error in red. I am using the names of the proxies as they are displayed in the console.

Code: Select all
$Proxies = "fakeproxy107v.somedomain.com","fakeproxy108v.somedomain.com","fakeproxy109v.somedomain.com","fakeproxy113v.somedomain.com","fakeproxy114v.somedomain.com","fakeproxy115v.somedomain.com","fakeproxy116v.somedomain.com","fakeproxy117v.somedomain.com","fakeproxy118v.somedomain.com"
$Jobs = Get-VBRJob | Where Name -Like "AUS_TEST*"
foreach ($Job in $jobs)
{
        Set-VBRJobProxy -Job $Job.Name -Proxy $Proxies
}


Set-VBRJobProxy : Cannot bind parameter 'Proxy'. Cannot convert the "fakeproxy107v.somedomain.com" value of type
"System.String" to type "Veeam.Backup.Core.IProxy".
At line:6 char:47
+ Set-VBRJobProxy -Job $Job.Name -Proxy $Proxies
+ ~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-VBRJobProxy], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Veeam.Backup.PowerShell.Command.SetVBRJobProxy
kefoster
Novice
 
Posts: 8
Liked: 2 times
Joined: Thu Jun 21, 2012 7:34 pm
Full Name: Kevin Foster

Re: Set-VBRJobProxy - Multiple Proxies

Veeam Logoby PTide » Thu Oct 01, 2015 4:20 pm

It seems that you are giving it an array of strings, while it expects to get an array of objects (proxy is an object) Please try the following syntax:

$myArray=$var1,$var2,$var3,$var4

where each $varN is Get-VBRViProxy -Name "Proxy Name"
PTide
Veeam Software
 
Posts: 3021
Liked: 246 times
Joined: Tue May 19, 2015 1:46 pm

Re: Set-VBRJobProxy - Multiple Proxies

Veeam Logoby kefoster » Thu Oct 01, 2015 4:23 pm 1 person likes this post

Thank you! I used the following to get the Proxies I needed.
Code: Select all
$Proxies = Get-VBRViProxy | where Name -Like "*aus*"
kefoster
Novice
 
Posts: 8
Liked: 2 times
Joined: Thu Jun 21, 2012 7:34 pm
Full Name: Kevin Foster

Re: Set-VBRJobProxy - Multiple Proxies

Veeam Logoby v.Eremin » Thu Oct 01, 2015 4:34 pm

Also, -Job parameter should be of a different type. Currently, you're trying to pass a string object to it ($Job.name is a string), while it accepts CBackupJob entities, instead. So, you should use $Job variable, not $Job.name. Thanks.
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Set-VBRJobProxy - Multiple Proxies

Veeam Logoby kefoster » Thu Oct 01, 2015 4:38 pm 1 person likes this post

v.Eremin wrote:Also, -Job parameter should be of a different type. Currently, you're trying to pass a string object to it ($Job.name is a string), while it accepts CBackupJob entities, instead. So, you should use $Job variable, not $Job.name. Thanks.


Good to know. It worked using the $Job.Name so I got lucky! Still trying to figure this all out!

Thank you all for your help!

PS Just saw the big red print about POSTING AN ERROR... I did have a case but they said they couldn't help and gave me the URL for this forum Case # 01073141
kefoster
Novice
 
Posts: 8
Liked: 2 times
Joined: Thu Jun 21, 2012 7:34 pm
Full Name: Kevin Foster

Re: Set-VBRJobProxy - Multiple Proxies

Veeam Logoby v.Eremin » Thu Oct 01, 2015 5:25 pm

Glad to hear you've sorted it our.

Support case is required while posting about technical issues and similar. In the meantime, if you're looking for a general advice or need some help with scripting it's OK to post without it.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 6 guests