Home Service Manager

Powershell Support Group Changes

Mike_BrancoMike_Branco Customer IT Monkey ✭

Hello,

We are consolidating a few support groups and I would like to move any active/closed tickets that are assigned to one support group into the other support group before deleting it.

Can this be done through powershell scripting? If so, can someone please provide information on how this would be done?

Thank you in advanced,

Mike Branco

Best Answer

  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
    Answer ✓

    I threw this together really quickly, this will walk you through identifying enums and then updating a group of Incidents assigned to a Support Group to a different Support Group.

    If you have a dev environment, check it out there first.

    #Step 1 - We need to find the enumerations we need to work with
    $mgmtServer = "localhost"
    Get-SCSMEnumeration -name "IncidentTierQueuesEnum" -ComputerName $mgmtServer | Get-SCSMChildEnumeration -ComputerName $mgmtServer  | Select-Object Id, DisplayName
    
    #Step 2 - Get the Incidents of a Specific Support Group (Tier Queue) per the above ID
    $irClass = Get-SCSMClass -Name "System.WorkItem.Incident$" -computername $mgmtServer
    $incidents = Get-SCSMObject -class $irClass -Filter "TierQueue -eq '4c17850c-fd4d-c1ff-9548-d0a246747fd0'" -computername $mgmtServer
    
    #Step 3 - View the Incidents we got back
    $incidents
    
    #Step 4 - Change the Support Group
    foreach ($incident in $incidents)
    {
        Set-SCSMObject -SMObject $incident -Property "TierQueue" -Value "af422ab9-9d5e-46c1-a2b0-d36ea07acf0e" -computername $mgmtServer
    }
    

Answers

  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭

    Hey there Mike,

    Check out Part 3 in our Definitive SCSM PowerShell series that covers working with enums and changing properties.


  • Mike_BrancoMike_Branco Customer IT Monkey ✭

    Thanks for the link - it looks like that works for 1 specific IR/SR, is there a way to capture all of them in an array and change them at once?

    example : anything that has the support group assigned as 'Service Desk' (open/closed tickets) all changed to be 'Service Analyst'

  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭

    Yes, the idea would be instead of Filtering on a specific IR/SR you'd filter on the TierQueue/SupportGroup property so you'd return many Work Items instead of one.

  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭

    Hey @Mike_Branco just wanted to see how you got on with this?

  • Mike_BrancoMike_Branco Customer IT Monkey ✭

    Thanks for the follow-up.

    That site did help to a certain extent but was still unable to make the correct script for it.

  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
    Answer ✓

    I threw this together really quickly, this will walk you through identifying enums and then updating a group of Incidents assigned to a Support Group to a different Support Group.

    If you have a dev environment, check it out there first.

    #Step 1 - We need to find the enumerations we need to work with
    $mgmtServer = "localhost"
    Get-SCSMEnumeration -name "IncidentTierQueuesEnum" -ComputerName $mgmtServer | Get-SCSMChildEnumeration -ComputerName $mgmtServer  | Select-Object Id, DisplayName
    
    #Step 2 - Get the Incidents of a Specific Support Group (Tier Queue) per the above ID
    $irClass = Get-SCSMClass -Name "System.WorkItem.Incident$" -computername $mgmtServer
    $incidents = Get-SCSMObject -class $irClass -Filter "TierQueue -eq '4c17850c-fd4d-c1ff-9548-d0a246747fd0'" -computername $mgmtServer
    
    #Step 3 - View the Incidents we got back
    $incidents
    
    #Step 4 - Change the Support Group
    foreach ($incident in $incidents)
    {
        Set-SCSMObject -SMObject $incident -Property "TierQueue" -Value "af422ab9-9d5e-46c1-a2b0-d36ea07acf0e" -computername $mgmtServer
    }
    
  • Mike_BrancoMike_Branco Customer IT Monkey ✭

    thank you very much, that worked perfectly!

Sign In or Register to comment.