Archive | Service Manager

List SCSM 2012 Template Information

This script will list all SCSM Templates and show information about the following Templates:

  • Incident
  • Service Request
  • Problem
  • Change
  • Release

For Templates other than the one above the script will only show Title and Description information.

The script is dependent on the PowerShell module SMLets, so it needs to be installed before running the script.

To run the script just download it and run it in a PowerShell prompt. The output will look like something like this.

List SCSM 2012 Templates Information

PowerShell script: GetSCSMTemplateInformation

0

Tiny script that shows all SCSM 2012 Tier Queues that are empty

The other day I had the need to get all the Tier Queues that were not set in Service Manager 2012. This tiny script does the trick!

 

1

Get the SCSM View ElementID from MP with PowerShell

I had the need to get the View ElementID without opening the MP file. This is the simple PowerShell script to do this.

Just save the code to a .ps1 file and run it with the MP Filename and the Name of the View as parameters.
 

 

0

Web page displaying amount of SCSM Incidents, Service Requests and Change Requests

This is an example how to make a very easy web page displaying some status information regarding Incidents, Service Requests and Change Requests. The script is very easy to change and modify for your organization.

When being ran the script will create a web page as shown below. Please change the last line in the script and point it to a location where you want to put the web page.

1

Script Code

#################################################################
# Author: Jonathan Andersson systemcenterme.com
# Description: Create a simple web page showing case count
#################################################################

# Empty variable
$IRInt=0
$SRInt=0
$CRInt=0

Import-Module SMLets

$IRClass=Get-SCSMClass -Name System.workitem.Incident$
$CRClass=Get-SCSMClass -Name System.workitem.ChangeRequest$
$SRClass=Get-SCSMClass -Name System.WorkItem.ServiceRequest$ 

$IR=Get-SCSMObject -Class $IRClass -filter “Status -eq 5e2d3932-ca6d-1515-7310-6f58584df73e” # Active
$CR=Get-SCSMObject -Class $CRClass -filter “Status -eq 6d6c64dd-07ac-aaf5-f812-6a7cceb5154d” # In Progress
$SR=Get-SCSMObject -Class $SRClass -filter “Status -eq 59393f48-d85f-fa6d-2ebe-dcff395d7ed1” # In Progress

foreach($IRIin$IR){if($IRI.Priority -eq “1”){$IRInt++}}
foreach($CIin$CR){if($CRI.Priority.DisplayName -eq “High”){$CRInt++}}
foreach($SRIin$SR){if($SRI.Priority.DisplayName -eq “High”){$SRInt++}}

$IRTot=$IR.Count
$SRTot=$SR.Count
$CRTot=$CR.Count

# Get yesterdays date
$date=Get-Date
$DateOld= (Get-Date).AddDays(-1
$DateOldF=Get-Date $DateOld -format G

$IR24Tot=Get-SCSMObject -Class $IRClass -filter “Createddate -gt $DateOldF
$SR24Tot=Get-SCSMObject -Class $SRClass -filter “Createddate -gt $DateOldF
$CR24Tot=Get-SCSMObject -Class $CRClass -filter “Createddate -gt $DateOldF” 

$IR24TotC=$IR24Tot.Count
$SR24TotC=$SR24Tot.Count
$CR24TotC=$CR24Tot.Count 

$a=“<style>”
$a=$a+“BODY{background-color:white;}”
$a=$a+“TABLE{border-width: 1px;border-style: solid;border-color: white;border-collapse: collapse;}”
$a=$a+“TD{border-width: 1px;padding: 0px 5px 0px 5px;border-style: non;border-color: black;background-color:white}”
$a=$a+“TR{border-width: 1px;padding: 0px 5px 0px 5px;border-style: non;border-color: black;background-color:white}”
$a=$a+“</style>” 

ConvertTo-Html -head $a -title “Service Manager” -body
<h2>Service Manager</h2>
<table>
<tr>
<td><h4>All Open</h4></td>
</tr>
<tr>
<td>Incidents:</td><td>$IRTot</td>
</tr>
<tr>
<td>Service Requests:</td><td>$SRTot</td>
</tr>
<tr>
<td>Change Requests:</td><td>$CRTot</td>
</tr>
<tr>
<td><h4>All Open High Priority</h4></td>
</tr>
<tr>
<td>Incidents:</td><td>$IRInt</td>
</tr>
<tr>
<td>Service Requests:</td><td>$SRInt</td>
</tr>
<tr>
<td>Change Requests:</td><td>$CRInt</td>
</tr>
<tr>
<td><h4>Total last 24 hours</h4></td>
</tr>
<tr>
<td>Incidents:</td><td>$IR24TotC</td>
</tr>
<tr>
<td>Service Requests:</td><td>$SR24TotC</td>
</tr>
<tr>
<td>Change Requests:</td><td>$CR24TotC</td>
</tr>
</table>
<br />
<b>Last update:</b> $Date
| Out-File C:\tmp\test.html

Download Script: SCSM_Count_Case

1