-
- Influencer
- Posts: 13
- Liked: never
- Joined: Jun 13, 2024 3:57 pm
- Full Name: John Forman
- Contact:
Changes to PowerShell syntax after upgrade to 12.3
We have 2 scripts that have been used to remove then add proxy servers to jobs for an migration of proxy servers when we decommissioned 2 servers then added 2 new ones. The scripts worked great and saved us a ton of time.
We are now being asked to rename all of our proxy servers to generic names to be more in line with Veeam best practices (for example: VEPROXY06 to Server345).
The scripts no longer work since we have upgraded to 12.3. Does anyone know what changes have been made, or maybe depreciated, that we will need to update to get the scripts to work again? We have an open Veeam ticket on this, but last time we had an error they stated that PowerShell is provided as-is with no support for making or adjusting scripts (Case #07581663 -- Issue with a PowerScript to remove proxies from Backup Jobs).
Here are the scripts we are using:
Add Proxy
$newproxy = Get-VBRVIProxy -Name "SERVER354"
$jobs = Get-VBRJob | where {$_.TypetoString -eq "VmWare Backup"}
foreach ($job in $jobs)
{
$usedProxy = Get-VBRJobProxy -Job $job
$proxylist = $usedProxy + $newproxy
Set-VBRJobProxy -Job $job -Proxy $proxylist
}
Remove Proxy
$alljobs = Get-VBRJob
foreach ($job in $alljobs) {
[System.Collections.ArrayList]$origproxies = $job | Get-VBRJobProxy | foreach { $_ | Select-Object -ExpandProperty Name}
$origproxies.Remove('dev-vproxy3')
$newproxies = Get-VBRViProxy -Name $origproxies
$job | Set-VBRJobProxy -Proxy $newproxies
}
Thanks in advance for any help that you can provide.
We are now being asked to rename all of our proxy servers to generic names to be more in line with Veeam best practices (for example: VEPROXY06 to Server345).
The scripts no longer work since we have upgraded to 12.3. Does anyone know what changes have been made, or maybe depreciated, that we will need to update to get the scripts to work again? We have an open Veeam ticket on this, but last time we had an error they stated that PowerShell is provided as-is with no support for making or adjusting scripts (Case #07581663 -- Issue with a PowerScript to remove proxies from Backup Jobs).
Here are the scripts we are using:
Add Proxy
$newproxy = Get-VBRVIProxy -Name "SERVER354"
$jobs = Get-VBRJob | where {$_.TypetoString -eq "VmWare Backup"}
foreach ($job in $jobs)
{
$usedProxy = Get-VBRJobProxy -Job $job
$proxylist = $usedProxy + $newproxy
Set-VBRJobProxy -Job $job -Proxy $proxylist
}
Remove Proxy
$alljobs = Get-VBRJob
foreach ($job in $alljobs) {
[System.Collections.ArrayList]$origproxies = $job | Get-VBRJobProxy | foreach { $_ | Select-Object -ExpandProperty Name}
$origproxies.Remove('dev-vproxy3')
$newproxies = Get-VBRViProxy -Name $origproxies
$job | Set-VBRJobProxy -Proxy $newproxies
}
Thanks in advance for any help that you can provide.
-
- Veeam Software
- Posts: 2751
- Liked: 631 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Changes to PowerShell syntax after upgrade to 12.3
Hi John,
Can you clarify which part of your script is not working? Does it return an error or the script completes but does not make the desired changes?
The correct way to do this is with Set-VBRJobProxy. See the note here:
Sample workflow:
Works in lab both for adding new proxies and removing proxies, but perhaps you can share the full error you're getting and on which part of the script it fails.
Can you clarify which part of your script is not working? Does it return an error or the script completes but does not make the desired changes?
The correct way to do this is with Set-VBRJobProxy. See the note here:
Does it work if you build a new array of proxies to add to the job, and use Set-VBRJobProxy and pass your array of proxies.To modify settings, specify new values for the necessary parameters. The cmdlet will overwrite the previous parameter values with new values. The parameters that you omit will remain unchanged.
Sample workflow:
Code: Select all
$job = Get-VBRJob -Name "name of job"
$newProxy = @()
$newProxy =+ Get-VBRViProxy -Name "Proxy001"
$newProxy =+ Get-VBRViProxy -Name "Proxy002"
Set-VBRJobProxy -Job $job -Proxy $newProxy
David Domask | Product Management: Principal Analyst
-
- Influencer
- Posts: 13
- Liked: never
- Joined: Jun 13, 2024 3:57 pm
- Full Name: John Forman
- Contact:
Re: Changes to PowerShell syntax after upgrade to 12.3
Update:
I updated the 'add' script to:
And we are getting an error of:
Hope this helps in troubleshooting the 'add' script.
I updated the 'add' script to:
Code: Select all
$newproxy = Get-VBRVIProxy -Name "SERVER345.bks.one.xxxxx.xxx"
$jobs = Get-VBRComputerBackupJob | where {$_.TypetoString -eq "VmWare Backup"}
foreach ($job in $jobs){
$usedProxy = Get-VBRJobProxy -Job $job
$proxylist = $usedProxy + $newproxy
Set-VBRJobProxy -Job $job -Proxy $proxylist}
Code: Select all
+ foreach ($job in $jobs)
+ ~
Missing statement in body in foreach loop.
+CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorID : MissingForeachStatement
-
- Veeam Software
- Posts: 2751
- Liked: 631 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Changes to PowerShell syntax after upgrade to 12.3
Looking quick at the script, I think this one errored out because you used Get-VBRComputerBackupJob to populate jobs -- Get-VBRCOmputerBackupJob is for Agent-based backups and doesn't have a typetostring value of Vmware Backup. Please try it again with Get-VBRJob instead.
David Domask | Product Management: Principal Analyst
-
- Influencer
- Posts: 13
- Liked: never
- Joined: Jun 13, 2024 3:57 pm
- Full Name: John Forman
- Contact:
Re: Changes to PowerShell syntax after upgrade to 12.3
Thank you for the clarification on the 'get-vbrjob" cmdlet.
I re-ran the script with the proper cmdlet and while we didn't get any errors, the new proxy was not set on all the jobs:
I re-ran the script with the proper cmdlet and while we didn't get any errors, the new proxy was not set on all the jobs:
Code: Select all
$newproxy = Get-VBRVIProxy -Name "SERVER345.bks.one.xxxxx.xxx"
$jobs = Get-VBRJob | where {$_.TypetoString -eq "VmWare Backup"}
foreach ($job in $jobs){
$usedProxy = Get-VBRJobProxy -Job $job
$proxylist = $usedProxy + $newproxy
Set-VBRJobProxy -Job $job -Proxy $proxylist}
-
- Veeam Software
- Posts: 2751
- Liked: 631 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Changes to PowerShell syntax after upgrade to 12.3
Thanks for the update John.
Can you maybe pick a few jobs and run the script line by line without the foreach Loop? I've just tried reproducing your issue in my lab environment and I cannot, the script works each time.
Check the contents of each variable as you save it, something must not be getting populated but cannot tell what at the moment.
Can you maybe pick a few jobs and run the script line by line without the foreach Loop? I've just tried reproducing your issue in my lab environment and I cannot, the script works each time.
Check the contents of each variable as you save it, something must not be getting populated but cannot tell what at the moment.
David Domask | Product Management: Principal Analyst
-
- Influencer
- Posts: 13
- Liked: never
- Joined: Jun 13, 2024 3:57 pm
- Full Name: John Forman
- Contact:
Re: Changes to PowerShell syntax after upgrade to 12.3
Ok, I got it!
The only thing I am missing is to add an array to add multiple at a time, but I ran the script multiple times with the different proxy names it added them one by one to all VMWare proxy jobs; which is fine by me.
Now I just need to figure out how to edit our remove script to un-select the old proxy servers so we can delete them from the backup infrastructure. May I post here again if I need help with that?
The only thing I am missing is to add an array to add multiple at a time, but I ran the script multiple times with the different proxy names it added them one by one to all VMWare proxy jobs; which is fine by me.
Now I just need to figure out how to edit our remove script to un-select the old proxy servers so we can delete them from the backup infrastructure. May I post here again if I need help with that?
-
- Influencer
- Posts: 13
- Liked: never
- Joined: Jun 13, 2024 3:57 pm
- Full Name: John Forman
- Contact:
Re: Changes to PowerShell syntax after upgrade to 12.3
Ok, something else we are running into is the addition and removal of proxy servers as "Guest Interaction Proxy" settings. Is there a way to add / remove proxy servers from this function of the job by chance?
I am not seeing anything in the Veeam PowerShell reference that looks like it would apply.
I am not seeing anything in the Veeam PowerShell reference that looks like it would apply.
-
- Veeam Software
- Posts: 2751
- Liked: 631 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Changes to PowerShell syntax after upgrade to 12.3
Hi John,
Glad I could help, and sure, feel free to post any questions about your Veeam powershell scripts, we'll do our best to help
>addition and removal of proxy servers as "Guest Interaction Proxy" settings. Is there a way to add / remove proxy servers from this function of the job by chance?
At this time no, any managed Windows server in Veeam is automatically eligible to perform Guest Interaction Proxy role, however you can configure the job to only use specific Guest Interaction Proxies.
The unsupported method here still works in 12.3, and unfortunately is the only way to set the Guest Interaction Proxy settings programmatically, but it should be safe to use.
Glad I could help, and sure, feel free to post any questions about your Veeam powershell scripts, we'll do our best to help

>addition and removal of proxy servers as "Guest Interaction Proxy" settings. Is there a way to add / remove proxy servers from this function of the job by chance?
At this time no, any managed Windows server in Veeam is automatically eligible to perform Guest Interaction Proxy role, however you can configure the job to only use specific Guest Interaction Proxies.
The unsupported method here still works in 12.3, and unfortunately is the only way to set the Guest Interaction Proxy settings programmatically, but it should be safe to use.
David Domask | Product Management: Principal Analyst
Who is online
Users browsing this forum: No registered users and 5 guests