{"id":1513,"date":"2010-05-31T22:31:34","date_gmt":"2010-05-31T20:31:34","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=1513"},"modified":"2010-06-09T20:58:14","modified_gmt":"2010-06-09T18:58:14","slug":"update-incidents-by-e-mail-in-service-manager-2010","status":"publish","type":"post","link":"http:\/\/contoso.se\/blog\/?p=1513","title":{"rendered":"Update incidents by e-mail in Service Manager 2010"},"content":{"rendered":"<p><span style=\"color: #ff0000;\">Update: you can download my scripts <a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/emailscripts.zip\">here<\/a><\/span><\/p>\n<p>Out of the box Service Manager 2010 can generate incident based on incoming e-mails. But there is no default feature to update incidents based on incoming e-mails. In this post I will show you a solution to that. The flow of the e-mail will be<\/p>\n<ol>\n<li>A end-user sends a e-mail to scsm@scsmserver.hq.contoso.local<\/li>\n<li>The end-user is connected to the normal Exchange server, which will forward all e-mails for the scsmserver domain to my SCSM server<\/li>\n<li>On the SCSM server a vbscript will see if the e-mail contains &#8220;Contoso-IR&#8221; or not. If it does the e-mail will be moved to a &#8220;UpdateSCSM&#8221; folder, else it will be moved to a &#8220;NewSCSM&#8221; folder. As then it will generate a new incident in Service Manager<\/li>\n<li>Another vbscript will check all e-mails in the &#8220;UpdateSCSM folder&#8221;. The script will read &#8220;FROM&#8221; from each e-mail and which incident to update, it will then kick of a power shell script that will update the incident and attach the e-mail as related item.<\/li>\n<\/ol>\n<p>Instead of having Service Manager looking at all incoming e-mails the first vbscript will look at them. If the script decides that it is a e-mail that should generate a new incident it will move them over to a another folder and let Service Manager handle it with the default feature. Before you start, make sure to enable incoming e-mails in Service Manager (Administration, Settings, Incident Settings, Incoming E-mails).<\/p>\n<p>The first thing you need to configure is e-mail deliver to a folder. I use my Exchange 2010 machine to send all e-mails for the scsmserver.hq.contoso.local to my SCSM server. On my SCSM server I run IIS and the built-in SMTP feature. It will drop all e-mails to C:\\Inetpub\\mailroot\\drop. I have schedule the following vbscript to run every\u00c2\u00a0five minute to sort e-mails. If the e-mail contains &#8220;contoso-IR&#8221; it will be moved to the UpdateSCSM folder, else to the NewSCSM folder.<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails041.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1530  aligncenter\" title=\"20100527_incoming_emails04\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails041-300x299.jpg\" alt=\"\" width=\"300\" height=\"299\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails041-300x299.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails041-150x150.jpg 150w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails041.jpg 619w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center;\">\u00c2\u00a0<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails.jpg\"><\/a><\/p>\n<p>Once the e-mail is moved to the new folder, in my case C:\\Inetpub\\maildrop\\drop\\newSCSM\\, the following scripts looks into it<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails02.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1521  aligncenter\" title=\"20100527_incoming_emails02\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails02-300x191.jpg\" alt=\"\" width=\"300\" height=\"191\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails02-300x191.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails02.jpg 857w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>This script looks in all files and tries to find the incident ID. In the e-mail that\u00c2\u00a0SCSM send out to end-users about the incidents the subject contains Contoso-IRXX where XX is the incident ID.\u00c2\u00a0The script\u00c2\u00a0then take the file patch and the incidnet ID and starts a power shell script. This power shell script, see picture below, runs a cmdlet that my colleague <a href=\"http:\/\/www.litware.se\/\">Patrik<\/a> has build, you can download it <a href=\"http:\/\/smlets.codeplex.com\/\">here<\/a>. The Set-SCSMIncident cmdlet let you update a incident.\u00c2\u00a0The power shell script\u00c2\u00a0input a comment and attach the e-mail as a related item to the incident.<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100531.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1571\" title=\"20100531\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100531-300x64.jpg\" alt=\"\" width=\"300\" height=\"64\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100531-300x64.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100531.jpg 596w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center;\">\u00c2\u00a0<\/p>\n<p style=\"text-align: left;\">The following five pictures first show\u00c2\u00a0the notification template that sends a e-mail to the affected user when a incident is created. As you can see the subject line contains Contoso-IR&lt;Incident ID&gt;, that is also the string that we look for in incoming e-mails.\u00c2\u00a0In the last\u00c2\u00a0four pictures you can see the e-mail that a affected user recives when a incident is registered. The end-user replies with and includes the Contoso-IRXX in the subject line. In Service Manager the incident is updated in the action log and the e-mail is attached as a attached file.<\/p>\n<p style=\"text-align: left;\">If you have problem with open EML files, please take a look at <a href=\"http:\/\/www.msoutlook.info\/question\/354\">this<\/a> post.<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails07.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1533  aligncenter\" title=\"20100527_incoming_emails07\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails07-300x127.jpg\" alt=\"\" width=\"300\" height=\"127\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails07-300x127.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails07.jpg 577w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails08.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-1536\" title=\"20100527_incoming_emails08\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails08-300x163.jpg\" alt=\"\" width=\"300\" height=\"163\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails08-300x163.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails08.jpg 460w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails09.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1537 alignright\" title=\"20100527_incoming_emails09\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails09-300x164.jpg\" alt=\"\" width=\"300\" height=\"164\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails09-300x164.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails09.jpg 444w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails10.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-1540\" title=\"20100527_incoming_emails10\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails10-300x147.jpg\" alt=\"\" width=\"300\" height=\"147\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails10-300x147.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails10.jpg 726w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails11.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-medium wp-image-1541\" title=\"20100527_incoming_emails11\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails11-300x94.jpg\" alt=\"\" width=\"300\" height=\"94\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails11-300x94.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2010\/05\/20100527_incoming_emails11.jpg 668w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: left;\">\u00c2\u00a0<\/p>\n<p style=\"text-align: left;\">\u00c2\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update: you can download my scripts here Out of the box Service Manager 2010 can generate incident based on incoming e-mails. But there is no default feature to update incidents based on incoming e-mails. In this post I will show you a solution to that. The flow of the e-mail will be A end-user sends &hellip; <a href=\"http:\/\/contoso.se\/blog\/?p=1513\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[25],"tags":[],"class_list":["post-1513","post","type-post","status-publish","format-standard","hentry","category-system-center-service-desk"],"_links":{"self":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1513","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1513"}],"version-history":[{"count":33,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1513\/revisions"}],"predecessor-version":[{"id":1589,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1513\/revisions\/1589"}],"wp:attachment":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1513"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}