PowerShell script exchange
Post Reply
jasonp26
Lurker
Posts: 2
Liked: never
Joined: Jul 06, 2017 2:55 pm
Full Name: Jason
Contact:

Check if proxy is processing a job

Post by jasonp26 »

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?

Code: Select all

$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."
}
david.domask
Veeam Software
Posts: 2791
Liked: 637 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Check if proxy is processing a job

Post by david.domask »

Hi Jason,

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
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests