Changing an incidents title through PowerShell

Aug 13, 2013 at 12:28 PM
I'm working on a script to create and resolve incident quickly, creating and resolving incidents can be a slow process on older systems.

I still need to figure out how to chance an incidents Title, to contain the incidents ID.

Is there a shell for that?

My Shell skills are farely limited.

This is what i god so far, it will create an Incident, then assign it to me
Import-Module SMlets
###Create Quick Incident
$AffectedUser = Read-host -Prompt 'Affected Users initials'
$Title = Read-host -Prompt 'Short Title'
$Description = 'Quick incident, no description neccesary'
New-SCSMincident -impact low -Urgency Medium -Title QuickXYZ-$Title -Description $Description -Classification Quick -affecteduser Esbjerg\$AffectedUser
###Assign user to Incident
$Username = "AdmReH"
$Domain = "Esbjerg"
$I = get-SCSMObject (Get-SCSMClass System.WorkItem.Incident$) -filter "Title -eq QuickXYZ-$Title"
$U = Get-SCSMObject (Get-SCSMClass System.Domain.User$) | ?{$_.Domain -eq $domain -and $_.Username -eq $username}
$R = Get-SCSMRelationshipClass System.WorkItemAssignedToUser$
$N = New-SCSMRelationshipObject -Relationship $R -Source $I -Target $U -NoCommit
Remove-Module SMLets