Creating Incidents in Service Manager Programmatically on the Command Line

Many systems in an IT organization are under management by various management systems – Operations Manager, custom scripts, products that compete with System Center, etc. They all need to have a way to get incidents into the central incident management system such as System Center Service Manager.


Microsoft provides connectors out of the box to create incidents in Service Manager automatically from Operations Manager or Configuration Manager – but what about everything else? Microsoft and our partners will certainly provide connectors to other systems over time, but sometimes you just need something really simple.


Awhile ago I wrote a simple CreateIncident.exe application to provide an example of how to use the Data Access Service.  I’ve expanded that now to handle multiple command line switches for specifying properties of the incident to be created.  This is also a good example of writing code against the Service Manager SDK.  For those of you interested, I’ve provided the sample project which is distributed under the Microsoft Public License so you can modify it if you like to meet your needs.  For those of you just looking to use this as a lightweight way to inject incidents into Service Manager you can just download the executable.  If you run CreateIncident.exe /? you will get all the information you need for usage.  Usage can be as simple as:


CreateIncident.exe /Title “This is my incident”


Or can get pretty robust like this:


image


Known limitations (and opportunities for the community to take this to the next level):



  • Does not support type projections so you can only set properties directly on the incident class (or inherited properties)

  • This is one-way only to get incidents into the database.  This doesn’t update incidents.

  • I’ve done only basic testing on it.

Note: the CreateIncident.exe is located in the \bin folder inside of the attached .zip of the Visual Studio project. 


Enjoy!

CreateIncidentVisualStudioProject.zip