Monday 5 March 2012

Service Manager - Bulk change the priority (Impact & Urgency)

A customer had the requirement the other day to bulk change the priority on a certain classification of Incidents (They were using incidents of a certain classification in place of Service Requests)

I ran into a problem getting Orchestrator connected to SCSM, so it was time for a quick PowerShell script.

Import-Module SMLETS
$IRClass = Get-SCSMClass -Name System.WorkItem.Incident$
$EnumClass = Get-SCSMEnumeration | Where-Object{$_.displayname -eq 'Other Problems'}
$IRs = Get-SCSMObject -Class $IRClass |Where-Object{$_.Classification -eq $EnumClass}
$PropertyHashTable = @{"Impact" = "Low"}
$IRs | Set-SCSMObject -PropertyHashtable $PropertyHashTable
$PropertyHashTable = @{"Urgency" = "Low"}
$IRs | Set-SCSMObject -PropertyHashtable $PropertyHashTable

This basically finds all incidents of classification 'Other Problems' (just as an example!) and then changes the impact and urgency to low, therefore putting the priority to the lowest possible value.

Disclaimer: This script is provided as is, with no warranties, expressed or implied and has only been tested within my test environment.

No comments: