PowerShell script exchange
Post Reply
electricd7
Expert
Posts: 121
Liked: 7 times
Joined: Mar 27, 2012 10:13 pm
Full Name: Chad Killion
Contact:

How would I check for running backup jobs?

Post by electricd7 »

Hello,

I have a specific need for a way to poll Veeam server and check if any Backup jobs are running. I need to return TRUE only if there is an actual backup job running, I would return FALSE if the job type is instant-restore, restore, etc, but TRUE if job type was a backup job. Is there an easy way to poll the system and return that information quickly?
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How would I check for running backup jobs?

Post by veremin »

Check the following example and see whether it's something you're looking for:

Code: Select all

Asnp VeeamPSSnapin
$Trigger = $Null
$RunningJobs = Get-VBRJob | where {$_.JobType -eq "Backup" -and {$_.GetLatestState()} -eq "Working"} | select name
if ($RunningJobs.Count -ne 0) {$Trigger = $True}
else {$Trigger = $False}
Thanks.
electricd7
Expert
Posts: 121
Liked: 7 times
Joined: Mar 27, 2012 10:13 pm
Full Name: Chad Killion
Contact:

Re: How would I check for running backup jobs?

Post by electricd7 »

Perfect! Thanks so much!
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How would I check for running backup jobs?

Post by veremin »

You're welcome. Should other help be needed, don't hesitate to let us know. Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests