Creating Incidents in Service Manager Programmatically on the Command Line

Creating Incidents in Service Manager Programmatically on the Command Line

  • Comments 3
  • Likes

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!

Attachment: CreateIncidentVisualStudioProject.zip
Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Hi Travis,

    I incorporated this code into a inforpath webform thats creates a bacth file to run the createincident on the local server, but when trying to run createincident execute on the server i am getting event id's 1000 and 1001 related to KERNALBASE.dll. Do you have any idea what would cause this error? as works fine on machines on the network

  • Sorry Darren - I dont have a clue on that one...

  • Microsoft engineers always public half-working solutions.dll-hell :)