Merge two incidents

Posted: 15th July 2010 by Anders Bengtsson in System Center Service Manager

I have seen the question at Technet forums a number of times, is it possible to merge to incidents? In this post I have built a idea how to do it. When you run it you input two incident numbers. The first number  is the incident that you want to keep, and the second number is the incident that you want to close. The script will move all comments from the action log in the first incident to the second, so your comments will be moved to the incident that will be keep open. This solution require smlets that you can download here.

I made some notes about how it works…

It includes a couple of scripts

  • MergeInc.vbs, main vbscript
  • GetComments.ps1, powershell script that export comments from the incident that you want to close. All comments are stored in C:\temp\export.txt
  • UpdateIncident.ps1, powershell script that update the incident that you want to keep. It will be updated with all the old comments, in one large private comment in the action log
  • CloseIncident.ps1, powershell script that will close the incident that you don’t want to keep anymore

You can run MergeInc.vbs as a task from the console, the same way I do with a script in this post. You could of course pick up a incident ID from the console when you run the console. In this example I have two incidents, IR67 and IR69. For some reason IR69 is a double of  IR67 so we want to move the comments from IR69 to IR67 and close IR69.

Run the task and input IR69 and IR67.

Then IR69 is now closed and there is a comment in the action log

and if we look at IR67 the action log is now updated with all the old comments from IR69

It is not a optimized enterprise ready solution but it works. You can download my scripts here, Merge.

  1. oh, great! Please keep me posted!

  2. Doug says:

    Thanks Anders, looks like a codeplex project to me! Let me see what we can do here in San Diego.

  3. Hi, that could be done with Orchestrator now, I have a similar blog post here, http://contoso.se/blog/?p=2943

  4. Doug says:

    Anders,

    Any plans for upgrading this great feature for SCSM 2012?

  5. John says:

    “I think because in GetComment.ps1 it can’t out-file export.txt”

    Same problem here…
    Any fix?

  6. Hi, thanks for reading my blog. I have not test it for a while so I think we should test it with latest version of SMLET to be sure. But today I would also look into doing it with Orchestrator/Opalis instead.

  7. Doug says:

    Anders,

    Does this script need to be updated to reflect SMLET changes or will it work with the most current version?

  8. phu says:

    hi,

    I’m trying run MergeInc.vbs but receive a error: C:\Merge\MergeInc.vbs(33, 1) Microsoft VBScript runtime error: File not found

    I follow this steps:
    1/ Create folder C:\Merge to contain your files
    2/ In GetComments.ps1,UpdateIncident.ps1, CloseIncident i replaced “Add-PSSnapin smcomlets” to “Import-Module smlets”
    3/ And in GetComments,MergeInc i replaced “C:\temp\export.txt” to “C:\Merge\export.txt”

    I think because in GetComment.ps1 it can’t out-file export.txt
    What wrong?

    thanks,
    phu

  9. You can always look at the old incident, it is only closed and resolved.

  10. Paul says:

    The merge seems to delete the old incident and simply add a log to the incident to be merged – where can I find the details of the old incident (e.g. description) in the merged/updated one?

  11. [...] This post was mentioned on Twitter by FAQShop, FAQShop. FAQShop said: [www.contoso.se] Merge two incidents: I have seen the question at Technet forums a number of times, is it possible… http://bit.ly/asWwjr [...]