Monthly Archives: January 2015

Service Manager 2012 PowerShell Exchange “Connector”

There is a Exchange connector for Service Manager but in my experience i think it lacks a bit of features. And it is not possible to configure it as much as i want to. To create a work around for the exchange connector i created a Powershell based “connector”

This is a kind of concept that shows you that you can create awesome stuff with Powershell and tweak you’re mail integration a lot more then with the normal connector.

The “connector” works this way, you schedule it on a management server for a interval of 5 minutes and it will use the exchange web service to look in a mailbox for emails. The script also depends on SMlets. You can download The Exchange web service here and SMlets here

By default it process all emails that has a IR prefix or SR prefix. If it finds a email that does not contain a valid prefix it is processed as trash and an email is sent to the mail sender that it contained a invalid case number.

You can change this behavior to allow all mail that does not contain a prefix or SR/IR so the “connector” will create a new incident with that content. The new incident will use a specified Incident template.

I have tested the script from a Windows 2012 R2 server with Service Manager 2012 R2 (works with UR4 also) and on a office 365 mailbox. It should work against Exchange 2010 for example if auto discovery is configured.

Functions in version 1.0

  • Incident Comments from email
  • Service Requests comments from email
  • Incident attached files added to the Incident
  • Service Request attached files added to the service request
  • Ability to create new incidents from email based on incident templates
  • If the sender of the email does not exists as a CI in service manager database an internal account will be created for that user.
  • All processed emails are kept in a folder in the mailbox
  • If the incident or service request is in the status closed the user gets an email saying the mail was not processed due to cases being closed.

Here is an example for a email that contains attached file. The subject for this email was IR122 and contained the file IR122.txt and the text “This is a test comment sent into IR122 with an attached file”

email_before_incident_process

After the powershell script has run we can look in the action log and you can now see that there is an entry from me and a attached file (Bifogad fil in Swedish)

email_after_incident_process

And on the related object page we can see the attached file.email_after_incident_process_relatedItems

Functions that i am working on in version 1.1

  • Be able to resolve incident by sending [resolved] in the email tag
  • Be able to complete service requests by sending [completed] in the email tag
  • Splitting the code into more functions and modules to get an more easy overview of the code

Download

The script is available on technet gallery. Here is the link.

If you want something more added in future versions just throw in a comment below.