Getting Started with Service Manager Cmdlets for Windows PowerShell

Applies To: System Center Service Manager 2010 SP1

Windows PowerShell is a Windows command-line shell that includes an interactive prompt and a scripting environment. Windows PowerShell uses cmdlets (pronounced "command-lets") to manipulate the Windows PowerShell objects. Service Manager includes several cmdlets that you can use to perform various Service Manager-related tasks without using the Service Manager console. For example, you can use the Import-SCSMManagementPack cmdlet to import a management pack.

The Service Manager cmdlets set includes cmdlets that operate on the data warehouse database, and, therefore, you typically run them on the data warehouse management server. The rest of the Service Manager cmdlets are typically run on the Service Manager management server

Data returned from Windows PowerShell command might contain more information than can be displayed in a default Windows PowerShell command window. We recommend increasing the width to 120. Right-click the title bar, click Properties, and in the Layout tab, set the Screen Buffer Size width to 120.

Every time you start a Windows PowerShell session to run a Service Manager cmdlet, you must first add the Service Manager Windows PowerShell snap-in as described below.

To add the Service Manager Windows PowerShell snap-in to a Windows PowerShell session

  1. On the computer that you run Windows PowerShell on, for example, the computer that hosts the Service Manager or data warehouse management server, on the taskbar, click Start, point to Programs, point to Windows PowerShell 1.0, right-click Windows PowerShell, and then click Run as administrator.

  2. In the Windows PowerShell window, type the following commands:

Set-ExecutionPolicy RemoteSigned
Add-PSSnapIn SMCmdletSnapIn

To verify that the Service Manager Windows PowerShell snap-in has been added

  1. On the taskbar, click Start, point to Programs, point to Windows PowerShell 1.0, and then click Windows PowerShell to open a Windows PowerShell window.

  2. Type the following command, and look for Service Manager cmdlets such as Add-SCDWMgmtGroup and Export-SCSMManagementPack:

Add-PSSnapIn SMCmdletSnapIn
Get-Command –pssnapin SMCmdletSnapIn

Tip

Tab completion is a simple method that you can use to verify that a Windows PowerShell cmdlet has been added. For example, you can type Add-SC, and then press the Tab key, which automatically completes the command.

To get Help for a cmdlet

  1. On the taskbar, click Start, point to Programs, point to Windows PowerShell 1.0, and then click Windows PowerShell to open a Windows PowerShell window.

  2. Type the following command. Replace <cmdlet-name> with the name of the cmdlet that you must get help for, for example, Import-SCSMManagementPack:

Add-PSSnapIn SMCmdletSnapIn
get-help <cmdlet-name> -detailed

Did you find this information helpful? Please send your suggestions and comments about System Center Service Manager documentation to scsmdocs@microsoft.com.