SCSM: Send IncidentInfo by Mail

In our projects to deploy ServiceManager, we often run into the problem that customers want to get Information
from tickets and store it for i.e. searching. Unfortunately, closed Tickets dont show  much information, you cant
get access to attachments neither ActionLog entries.

Reopening them via Powershell/Orchestrator might fire workflows and notifications which causes chaos, so thats
no way to go. What we built here is a solution to get a ticketinformation from a closed ticket by task.

It delivers title/description, ActionLog entries and attachments to a common mailbox, triggerd by a console-task.

SendTicketInfo-Console

The resulting E-Mail:

STI-Result

How to build it

You need:

  • SCSM 2012
  • Orchestrator
  • A central accessible fileshare
  • The Orchestrator Remote Tools installed on a central share
  • Powershell

1.) Enable Powershell remoting on SCOR and SCSM Server

On both machines, open a PS Session as Administrator and enter

and walk through the wizard.

2.) Enable CredSSP authentication on both machines (Client/Server)

This alone helps executing commands remotely, but it runs under the system account,
which cannot access fileshares. To make this possible you have to anable remote
authentication via CrepSSP. More on this here.

Now we can use -Authentication CredSSP in Powershell between this two machines.

 3.) Prepare the promptless script (no password prompt)

Now with Remoting and CredSSP you will still be prompted for a password
which makes no sense in a SCOR script. The solutuion is found here.

First we create a file with an encrypted password.

!!! Importtant !!! You have to create the File with the Orchestrator ServiceAccount Credentials,
so start a powershell session with the Service account and. Otherwiese the file will not
be usable in the .Net Script.

Furthermore the script will only run in a usercontext of the SCOR Service Account
– so forget runbook-testing that part, bcs this will be with the logged on-account
where the username doesnt fit to the Service Account-password file.

read-host -assecurestring | convertfrom-securestring
| out-file \\server\share\password.txt

having this we can use username and password in any authentication mechanism in a powershell script using:

4.)  GetFileAttachments

Anders Bengston has written a Powershell Script which i used to extract file attachments from Incidents.
The original script can be found here. Download it and store it in a location
where everybody has at least read access \\server\share\dir\Get-Fileattachment.ps1

5.) Create a runbook which gets Incident Data

I actually created 2 runbooks, one for getting the incindet data, one for sending the E-Mail.
The runbook is attached as file.

The runbook gets information of the Ticket (Title, Description and AnalystComments) and
stores this as e-Mail BodyText in a temporary Textfile, which is then read to publish it to
the Send-E-Mail Runbook.

STI-Runbook1

This Runbook gets Data from the other runbook and sends out an e-Mail.

STI-Runbook2

6.) Insert the .Net Script

So the script uses the SCOR Service Account, creates a credential Info and then starts a remote-PS Session
(Invoke-Command) to the Service Manager Server to get the file-attachments. They are stored in the ArchiveRootPath.

7.) Start the Runbook remotely

The Orchestrator Remote Tools can start Runbooks by commandline.

After configuring the tools according to the attached documentation, your commandline would be something like this:

The Launcher starts a runbook (read ORT-Doc) according to the preconfigured XML file and passes 2
parameters (ID and Usermail), which come from the „Initialize Data“ Activity.

8.) Create a SCSM Task

The only thing you have to take care here is to paste the Incident ID in the commandline.

STI-Task3

STI-Task2

STI-Task1
Thats basically it. Have fun.

Runbook Files can be found here: SendTicketInfoRunbooks

Roman