Service Manager PowerShell Script to show cases that have not been updated in 2 days

2017-12-08T17:25:18+00:00 March 18th, 2011|Azure, Cloud, Windows|

Just a quick PowerShell script which will tell you if any active case in Service Manager has not been updated in 2 days. Obviously by changing the values for the time span ($LastModifiedBreached = New-Object Timespan 2,0,0,0,0)  you can alter how many days it is before your alerted.

CMDLets from “http://smlets.codeplex.com/

Import-Module SMLets
$LastModifiedBreached = New-Object Timespan 2,0,0,0,0
$incident = Get-SCSMIncident -Status active |?{$_.LastModified -lt (Get-Date).Subtract($LastModifiedBreached)}
$incident

If you want to change the status of the case if it’s not been updated then run the following ( Note you must create the new status before running the script)

Import-Module SMLets
$LastModifiedBreached = New-Object Timespan 2,0,0,0,0
$incident = Get-SCSMIncident -Status active |?{$_.LastModified -lt (Get-Date).Subtract($LastModifiedBreached)}
$incident | Set-SCSMIncident -Status “Customs status name you created”