We have several Veeam Proxies and I want to automate the OS patching while ensuring that the proxy is not running a job.
I am thinking the best way to do this is with Windows Task Scheduler and run a script. I want the script to check if that proxy is processing any Veeam jobs, then patch the OS and reboot or sleep and retry. I cant seem to figure out the proper way to check if the proxy is in use or not. Whats the best way to do this?
$serviceStatus = Get-Service -Name "Veeam Data Mover Service"
# Check if the service is running
if ($serviceStatus.Status -eq "Running") {
# Get the current jobs
$jobs = Get-VBRJob | Where-Object {$_.State -eq "Running"}
# Check if any jobs are running
if ($jobs.Count -gt 0) {
Write-Output "Veeam Data Mover is processing jobs."
} else {
Write-Output "Veeam Data Mover is running but not currently processing any jobs."
}
} else {
Write-Output "Veeam Data Mover service is not running."
}
I've moved your topic to our Powershell forums as I think it matches a bit better with your question.
I think that Get-VBRJob and checking the State parameter is sufficient, but note that Get-VBRJob applies to Vmware and Hyper-V backups only, so you may need to use additional cmdlets like Get-VBRComputerBackupJob.
But I think this is a pretty sane way of checking it in an automated way. You might consider adding a line that passes a given proxy to Disable-VBRViProxy (for VMware proxies) to ensure that the Veeam does not assign new tasks to the proxy you're updating, then after your update, enable the proxy again.
David Domask | Product Management: Principal Analyst