Auto Close Incidents

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

I have a couple of Service Manager customers that want to automatically close incidents one day after they are resolved by a analyst. It will save them some manually work. In this post I will show you how to build a workflow that does this. The following example will close incidents that has been in resolved state for two hours. This workflow require smlets that you can download here.

  1. Start the Service Manager Authoring Tool.
  2. Create a new management pack, for example Contoso.AutoClose
  3. Create a new workflow
    Name: ContosoAutoCloseWF
    Run at a scheduled time or at scheduled intervals
    Other interval, 2 hours
  4. Drag and drop the “Windows PowerShell Script” activiti from the toolbox to your workflow
  5. In the Details pane, click “Script body”
  6. Input the following script in the script body

    Get-SCSMIncident -Status Resolved -InactiveFor 02:00:00 | Set-SCSMIncident -Status Closed -comment “Closed due to duration of resolved period”

    The 02:00:00 is a TimeSpan declaration where 2 is the number of hours by hh:mm:ss. Observe that this will use the “lastmodified” timestamp for comparison and not the “resolved date”.

  7. On the script properties tab, input smcomlets as windows powershell snap-in required by the script
  8. Copy the ContosoAutoCloseWF.dll to the C:\Program Files\Microsoft System Center\Service Manager 2010 directory on your Management Server
  9. Import the management pack into Service Manager
  10. After a couple of hours, navigate to Administration/Workflows/Status and verify that your workflow is working
  11. Done!

Your workflow will now automatically close all incidents that has been in resolved state for at least two hours, without any update. It will also add a comment to the action log saying “Closed due to duration of resolved period”. If you get any problems with your workflow the look at Travis post about troubleshooting workflows here.

You can download a example of this here AutoClose.

  1. [...] This post was mentioned on Twitter by FAQShop, FAQShop. FAQShop said: [http://www.contoso.se] Auto Close Incidents: I have a couple of Service Manager customers that want to automatically clo… http://bit.ly/ad8bGL [...]