Hello guys...I'm really new on this, but I'm learning fast ;) I hope you can help me..I have this situation...
There are several Active incidents related to users that are not longer company employees. So basically the idea is to run an ps script including as a parameter the Incident Affected User so all the ACTIVE and RESOLVED related incidents will be automatically changed to closed.
I was exploring and trying something like this...but I bealive is not optimized...and probably is not sure to put into a production envirnonment.
get-scsmtypeprojection System.WorkItem.Incident.ProjectionType|Get-SCSMObjectProjection|?{$_.AffectedUser -like '*George Bush*'}|%{$_.object}|set-SCSMIncident -Status Closed
Problems:
*I cant find the way to replace the -like for some to expres equal doing a faster query and a correct match
*I cant add the Status to avoid include already Closed incident in the object protection filters
*finally, the performance I'm getting is really bad...and I have only 5000 incidents in my test db.
Thanks - Gus