PowerShell script exchange
Post Reply
ThinkGrid
Enthusiast
Posts: 55
Liked: 2 times
Joined: Jul 11, 2011 10:18 am
Contact:

powershell script for backup time

Post by ThinkGrid »

Hi guys

Is there any powershell script I can apply that would tell me if a Job has been running for more than 12 hours. I just want to be alerted rather than stop the job

Thanks
Petrit
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: powershell script for backup time

Post by veremin » 1 person likes this post

Have you considered Veeam ONE alerting system for that purpose; might be exactly what you're looking for? Thanks.
ehrnst
Enthusiast
Posts: 35
Liked: 1 time
Joined: Jan 31, 2014 8:24 am
Full Name: Martin Ehrnst
Contact:

Re: powershell script for backup time

Post by ehrnst »

This could probably get you going, just change the "totalhours" to be greather than. I did not have any jobs that have ben running for more than 20 minutes

Code: Select all

Get-VBRJob | Where {($_.GetLastState() -eq "Working") -and (((Get-Date) - $_.FindLastSession().CreationTime).TotalHours -lt '1')} | Select name, @{N="Start Time";E={($_.FindLastSession().CreationTime)}}, @{N="Status";E={($_.GetLastState())}}
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests