Can you update SM change request Assigned To to match created by with SMLETs?

alfie thomas 86 Reputation points
2022-05-04T17:28:08.613+00:00

Hi guys,

Not great at Runbooks or PowerShell but having trouble working with Change requests in either.

Has anyone got or seen a working example of either in PowerShell or in a runbook where you could have it update the Assigned To field to match the Created By field?

We are looking at standard changes and don't want to have to make people assign themselves to the change.

TIA.

Service Manager
Service Manager
A family of System Center products for managing incidents and problems.
209 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,165 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,382 questions
0 comments No comments
{count} votes

Accepted answer
  1. Limitless Technology 39,361 Reputation points
    2022-05-10T06:57:07.74+00:00

    Hi there,

    Found this PowerShell script try to execute this and see if this can help you in getting your requirements fulfilled.

    $incident = "IR3406"
    $username = "Lopez"
    $domain = "LAB"
    Import-Module SMLets
    $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
    $n = New-SCSMRelationshipObject -Relationship $r -Source $i -Target $u -NoCommit
    $n.Commit()
    Remove-Module SMLets

    You can read more about this from the below article

    Change Assigned user with SMlets https://learn.microsoft.com/en-us/answers/questions/410315/change-assigned-user-with-smlets.html

    SCSM how to change assigned to of an incident from PowerShell https://social.technet.microsoft.com/Forums/ie/en-US/cc9ce2db-26a5-4a06-b3cb-490872ac43c5/scsm-how-to-change-assigned-to-of-an-incident-from-powershell?forum=systemcenterservicemanager

    ------------------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept it as an answer–

    0 comments No comments

0 additional answers

Sort by: Most helpful