Orchestrator Runbook to reassign SCSM Incidents


I was working at a customer that was doing a domain migration. Service Manager was installed in the new domain, but up til now the analysts and users have used their old accounts. The task was to create a runbook, that reassinged all Incidents from the old user account to the new account.

It was a fairly new installation and there was less than 5.000 incidents to go through. So I decided to use Orhcestrator to be able to run the job, whenever new users were domain migrated.

I created the following runbook:

First part in the runbook was a Read line activity, to parse a file that contained the newest batch of migrated users. The file had a format of Username,Old_Domain.

 

 

 

 

 

 

Second part in the runbook found the relevant user in the CMDB, based on the input from the Read Line activity. In order to read the username  and domain, I used the following filters:

[Field(‘{Line text from “Read Line”}’,’,’,1)]

[Field(‘{Line text from “Read Line”}’,’,’,2)]

 

Third part in the runbook was a powershell script, this runs the SMLets locally on the Orchestrator Server and and returns a list of incidents, where the user is the Affected User.
Note: To get SMLets to run remotely I normally follow these guidelines: http://datacenterautomation.at/?p=233

 

Import-module smlets

$computername = “SCSM Management Server”

$incident = Get-SCSMIncident -ComputerName $computername | Where-Object {$_.AffectedUser -like ‘{Display Name from “Get Old User details”}*’}

if ($incident -ne $Null)

{

    $Incidentlist = @()

    foreach ($ir in $Incident)

        {

            $IncidentList += $ir.ID.value.tostring()

        }

}

The powershell script returned a variable named ‘IncidentList’ with the related incidents.

It’s not best practise using the Where-Object function, but my limited powershell skills on how to do a filter instead, forced me to use the where-object. Luckily the environment didn’t contain that many objects and I belive, it didn’t affect performance in general.

Fourth part in the runbook, used in output from the powershell script to load all the incidents

Fifth part in the runbook, loads the newly migrated user account. I knew the username was the same as the source account and also the name of the new domain. So I read the username from the input file and hardcoded the domain name.

Last and final part of the runbook change the Assigned to user with the newly migrated User object for all the Incidents that was previuosly returned.

I also created a similar runbook that changed the Affected User, which only requires a few changes in the powershell script and the last activity.

Get-SCSMIncident -ComputerName $SCSMServer | Where-Object {$_.AffectedUser -like ‘{Display Name from “Get Old User details”}*’}

 

 

Comments (3)

  1. Anonymous says:

    Okay, I figured out that I need to "Get Related Object Guid" from the relationship, and now I don't get the error anymore.

    But, the "Assigned to" field in the incident does not update, even though the event runs successfully. It just remains blank.

  2. Anonymous says:

    Hi Thomas,

    Great guide, thanks a lot.

    I'm using some of your guide (set assigned to user) for a different purpose, and have run into a problem.

    I'm getting a "Resolved by User"-relationship, then Get Object of that GUID, and setting this to Assigned to User, but I get this error when that event is executed:

    [d085cf0d-2ce6-93b5-fd5a-7e66ebb5ddba] is not an instance of class [Microsoft.AD.UserBase].

    Do you have any idea why? Thanks.

  3. showbox dl says:

    Thanks for the great info. I really loved this. I would like to apprentice at the same time as you amend your web site, how could i subscribe for a blog site?
    For more info on showbox please refer below sites:
    http://showboxandroids.com/showbox-apk/
    http://showboxappandroid.com/
    Latest version of Showbox App download for all android smart phones and tablets.
    http://movieboxappdownloads.com/ – It’s just 2 MB file you can easily get it on your android device without much trouble. Showbox app was well designed application for android to watch movies and TV shows, Cartoons and many more such things on your smartphone.
    For showbox on iOS (iPhone/iPad), please read below articles:
    http://showboxappk.com/showbox-for-ipad-download/
    http://showboxappk.com/showbox-for-iphone/
    Showbox for PC articles:
    http://showboxandroids.com/showbox-for-pc/
    http://showboxappandroid.com/showbox-for-pc-download/
    http://showboxforpcs.com/
    There are countless for PC clients as it is essentially easy to understand, simple to introduce, gives continuous administration, effectively reasonable. it is accessible at completely free of expense i.e., there will be no establishment charges and after establishment
    it doesn’t charge cash for watching films and recordings. Not simply watching, it likewise offers alternative to download recordings and motion pictures. The accompanying are the strides that are to be taken after to introduce Showbox application on Android.
    The above all else thing to be done is, go to the Security Settings on your Android telephone, Scroll down and tap on ‘Obscure sources’.