Hi, David.
It took me for a little while but I think, I managed to find a solution for your issue.
So, here it’s with some commentary.
Code: Select all
asnp VeeamPSSnapin
#First part of the script is responsible for disabling SourceProxyAutoDetection
$Job = Get-VBRJob | ?{$_.Name –eq “Name of your Job”}
$vo= $job.GetOptions()
$vo.JobOptions.SourceProxyAutoDetect = $False
$job.SetOptions($vo)
#After having done that, our goal is to exclude from our job all proxies except for one.
#Thus, second part of the script is checking proxies which names don't coincide with the name of the proxy we're going to leave.
#The result of that process is being saved in $Proxies list.
#In the end, within the cycle, we delete all of such proxies, meanwhile create the only one ($ProxytoAdd).
#Little note: $ProxyType = 0 means SourceProxy, 1 - TargetProxy.
$ProxyType = 0
$ProxyToAdd = Get-VBRViProxy| ?{$_.Name –eq "Name of proxy you're going to leave"}
$Proxies= Get-VbrViProxy | ?{$_.Name –ne $ProxyToAdd}
foreach($ProxytoDelete in $Proxies)
{
foreach($ProxyInfo in ([Veeam.Backup.DBManager.CDBManager]::Instance.JobProxies.GetJobProxies($Job.id, $ProxyType)))
{
if($ProxyInfo.ProxyId -eq $ProxyToDelete.id)
{
[Veeam.Backup.DBManager.CDBManager]::Instance.JobProxies.Delete($ProxyInfo.id)
}
}
}
[Veeam.Backup.Core.CJobProxy]::Create($Job.id, $ProxyToAdd.id, $ProxyType)
That’s all.
Even though, i've used it in earnest, it's still nothing but draft-work with a lot of space for improvement. Consequently, all commentary is higly-apprecieated.
Feel free to use and/or share it.
And don’t forget to try it before implementing.
Hope this helps.
Thanks.