Create Management Pack and Template in Service Manager with PowerShell

This post will describe how to create a Management Pack (MP) and a Template in Service Manager with PowerShell.

Before running the PowerShell commands install SMLets and import the module into the PowerShell prompt.

Create MP and Template

# Variables
$MPName = “Example”
$TemplateName = “Example”
$TemplateDescription = “Example”

# Create a new Management Pack
New-SCManagementPack -ManagementPackName $MPNAME -FriendlyName $MPNAME -DisplayName $MPNAME -version 7.5.1335

# Get the newly created Management Pack
$MP = Get-SCSMManagementPack “^${MPNAME}$”

# Get the Class. In this example the Class Service Request is selected
$Class = Get-scsmclass -Name System.Workitem.ServiceRequest$

# Create the Service Request Template
New-SCSMObjectTemplate  -DisplayName $TemplateName -ManagementPack $MP -Class $Class -Name $TemplateName -Description $TemplateDescription

Check if MP and Template been created

Get-SCSMManagementPack -Name <MPName>

Get-SCSMObjectTemplate -DisplayName <Template DisplayName>

2 Responses to Create Management Pack and Template in Service Manager with PowerShell

  1. Ben McGarry July 27, 2016 at 10:49 #

    Subject: Creating SCSM 2012 R2 Incident Templates using powershell. I have to create 350+ incident templates and pre-fill the following fields:
    Classification, Impact, Urgency, TierQueue, Affected Service (don’t ask!).
    I have used you article above to create multiple templates (many thanks, it saved me a lot of grief) however I can’t find a way of filling in the above template fields.
    Is it possible?
    Thanks a mil

  2. Ben McGarry July 29, 2016 at 12:15 #

    Hi Jonathan, Does the cmdlet New-SCSMObjectTemplate have parameters to update the Impact, Urgency, Tier-Queue and Affected Service fields? Thanks, Ben

Leave a Reply