How would I check for running backup jobs?

PowerShell script exchange

How would I check for running backup jobs?

Veeam Logoby electricd7 » Thu Dec 03, 2015 3:07 pm

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?
electricd7
Expert
 
Posts: 103
Liked: 5 times
Joined: Tue Mar 27, 2012 10:13 pm
Full Name: Chad Killion

Re: How would I check for running backup jobs?

Veeam Logoby v.Eremin » Thu Dec 03, 2015 4:49 pm

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.
v.Eremin
Veeam Software
 
Posts: 13288
Liked: 971 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: How would I check for running backup jobs?

Veeam Logoby electricd7 » Thu Dec 03, 2015 7:23 pm

Perfect! Thanks so much!
electricd7
Expert
 
Posts: 103
Liked: 5 times
Joined: Tue Mar 27, 2012 10:13 pm
Full Name: Chad Killion

Re: How would I check for running backup jobs?

Veeam Logoby v.Eremin » Fri Dec 04, 2015 9:11 am

You're welcome. Should other help be needed, don't hesitate to let us know. Thanks.
v.Eremin
Veeam Software
 
Posts: 13288
Liked: 971 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 11 guests