IT Knowledge Base

Technical Repository

HowTo: SCSM 2012 R2 – Update Incident Ticket AssignedTo User

1. Open Notepad and paste the following code. Save the file as UpdateAssignedTo.ps1.

$incident = "IR Number"
$username = "This is assgnedto username"
$domain = "Your domain netbios name "

$i = Get-SCSMObject (Get-SCSMClass System.WorkItem.Incident$) -Filter "Id -eq $incident"
$u = Get-SCSMObject (Get-SCSMClass System.Domain.User$) | ?{$_.Domain -eq $domain -and $_.Username -eq $username}
$r = Get-SCSMRelationshipClass System.WorkItemAssignedToUser
Get-SCSMRelationshipObject -Relationship $r | ?{$_.SourceObject -eq $i} | Remove-SCSMRelationshipObject
$nu = Get-SCSMObject (Get-SCSMClass System.Domain.User$) | ?{$_.Domain -eq $domain -and $_.Username -eq "Please type the new user name value for assisgnedto "}
$n = New-SCSMRelationshipObject -Relationship $r -Source $i -Target $nu –NoCommit
$n.commit()

2. Open SCSM 2012 Administrative Console and navigate to the Administration pane. In the Tasks pane, click Start Powershell Session. Navigate to the powershell script we just created and run it.



Leave a Reply