Archive

Posts Tagged ‘SCSM’

Quick Enum from database query

March 5, 2011 1 comment

If you want to quickly get the enumeration of a display string, you can run the following query on the ServiceManager database

select enum.EnumTypeId, enum.EnumTypeName, disp.DisplayName,
mp.MPName, mp.MPFriendlyName
from EnumType enum
join DisplayStringView disp on enum.EnumTypeName = disp.ElementName
join ManagementPack mp on enum.ManagementPackId = mp.ManagementPackId
where disp.LanguageCode='ENU'
and DisplayName = 'xxx'

Where ‘xxx’ is the display name such as ‘Auto Resolved by Problem’.  The above query of course is for English display strings.  You can replace ‘ENU’ with the language code of any other supported language.

Service Manager Enums, Classes and Relationship classes

March 5, 2011 Leave a comment

If you’ve had to use the CSV connector to import data and needed to know the enums for your list entries, or if you have manually authored a Management Pack and needed to know what classes or relationship classes to use, these tools may be helpful.  They retrieve the enums, classes and relationship classes for all management packs in your Service Manager database.

I have attached the VS 2008 project files if you are interested in the code.  For the executable, simply go to the <Project>\bin\debug folder.  All three executables have the same command line parameters:

-s <ManagementServer> [-d <domain> -u <username> -p <password>]

The -d -u -p parameters are required only if you are running the executable with non privileged or non trusted domain/workgroup account.

I suggest redirecting the output to a csv file because the data is comma delimited, with column headers.  E.g. executable.exe > output.csv

Enums

SMEnums.zip

The executable (SMEnums.exe) produces these comma separated columns:
EnumName, EnumId, EnumDisplayName, EnumParentId, MPName, MPDisplayName, MPId, MPKeyToken, MPVersion

Classes

SMClasses.zip

The executable (SMClasses.exe) produces these comma separated columns:
ClassId, ClassName, ClassDisplayName, MPName, MPDisplayName, MPVersion, MPKeyToken

Relationship Classes

SMRelClasses.zip

The executable (SMRelClasses.exe) produces these comma separated columns:
ClassId, ClassName, ClassDisplayName, MPName, MPDisplayName, MPVersion, MPKeyToken

Categories: Service Manager Tags: ,

Processing e-mail from unresolved (external) senders

February 23, 2011 2 comments

You probably already know that Service Manager will discard e-mail from senders it does not recognize, into the BadMail folder.  If you are not monitoring this folder, you could miss incident requests from users who occasionally, for one reason or another, send e-mail from their personal/home e-mail address rather than their corporate Active Directory linked e-mail address.  The solution described here is one I developed and implemented with a client in December 2010.  It eliminates the need to monitor the BadMail folder, and automatically creates incidents of all e-mails discarded by Service Manager.

The External Mail Processor Service

The External Mail Processor Service is a Windows service that can run on any computer with the .Net framework 3.5 or higher.  The only security requirements are that the service account have access to Service Manager’s BadMail folder, and be able to create incidents in Service Manager.

The External Mail Processor service works by monitoring the BadMail folder with a file system watcher.  When Service Manager discards an incident e-mail file (.eml) into the BadMail folder, the service detects and immediately processes the file.  An incident is created of the e-mail just as Service Manager would.  The e-mail subject becomes the incident title, the first 4000 characters of  the body body become the incident description, and the .eml file itself is added as an attachment to the incident.  One notable difference is that the senders e-mail address is added as the Alternate Contact Method of the incident, rather than as the Affected User.  The service also enables ignoring e-mails based on senders address or subject.

Configuring and Installing the Service

Download and extract the SMExtMailProcessor.zip file to a computer running the .Net framework 3.5.  The zip file includes the following files:

  • SMExtMailProcessor.exe
  • SMExtMailProcessor.exe.config
  • Microsoft.EnterpriseManagement.ServiceManager.dll
  • Microsoft.EnterpriseManagement.Packaging.dll
  • Interop.CDO.dll
  • Interop.ADODB.dll

Using a text or XML editor, open SMExtMailProcessor.exe.config to customize the settings.  There are two kinds or settings.  Single value settings such as

            <setting name="BadMailFolder" serializeAs="String">
                <value>C:\inetpub\mailroot\BadMail</value>
            </setting>

which take a single value and multi-value settings such as

            <setting name="IgnoreSenders" serializeAs="Xml">
                <value>
                    <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                        <string>JoeSpammer@spammail.com</string>
                        <string>Sue@buycheapdrugs.com</string>
                    </ArrayOfString>
                </value>
            </setting>

which can have multiple values each surrounded by a <string></string> tag.

The settings to be customized are:

  • BadMailFolder: Single value. The location of Service Manager’s BadMail folder.  This can be a local path or a UNC.  Verify that the service account has the necessary NTFS and/or share permissions.
  • ProcessedFolder: Single value. You need to create this folder.  All processed .eml files will be placed into this folder *if* the DeleteAfterProcessing setting is set to False.
  • IgnoreSenders: Multiple values.  List of e-mail address to ignore (not create incidents).  A ‘contains’ comparison of these values to the senders e-mail address is performed, so you can specify partial strings here – such as just the domain name if you want to ignore an entire domain.
  • IgnoreSubjects: Multiple values.  List of e-mail subjects to ignore.  This is also a ‘contains’ comparison.
  • IncidentIDPrefix: Single value.  A prefix for incidents created.  This is typically IR.
  • IncidentSubjectPrefix: Single value.  Optional.  A string to prefix the Title of each incident.
  • DeleteAfterProcessing: Single value. Set this value to True if you want the .eml files deleted after they are processed.  If you set it to False, the files will be moved to the ProcessedFolder after processing.
  • ManagementServer: Single value.  The Service Manager management server.  If you run this service on the Service Manager server, leave this value as localhost.
  • Verbose: Single value.  Set to False unless when troubleshooting.

After modifying the .config file, you need to install the service. The service needs to run with a domain account.  The account must have permissions to read, write and delete in the BadMailFolder and ProcessedFolder folders specified in the .config file, and must have permissions in Service Manager to create incidents. 

To install the service, open an elevated command prompt at the folder with the extracted files and run:

\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe SMExtMailProcessor.exe

The assembly installer will prompt you to specify a service login and password.  The installation is logged to InstallUtil.InstallLog in the same folder, which can be opened with notepad.  After successful installation, you can start the service using Services.msc.  The service name is “Service Manager External Mail Processor”. 

The service logs to the Windows application event log, event source ‘SMExtMailProcessor’.

Uninstalling the Service

Open an elevated command prompt at the folder with the service executable and run:

\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe /u SMExtMailProcessor.exe