PowerShell/SCSM - Install and Config the SMlets Module

If you follow my blog, you might have noticed that I recently started to post about SCSM. We just finished to migrate to a new SCSM environment in Azure (Iaas) while using Cireson Portal as a front end.

Of course of lot of the automation part is handled by SCORCH in the background which rely on a lot of PowerShell :-)  (We don't use SMA yet, but I will soon look into it)

Anyway I just wanted to post a quick article on how to configure SMlets on a workstation to be able to query SCSM.

First, if you don't have the SCSM console installed locally, you'll need to install the SDK

Download: http://msdn.microsoft.com/en-us/windows/desktop/bg162891.aspx

Make sure to select only the feature: .NET Framework 4.5.1 during the installation

Browse to one of the following locations:
\\<SCSM_SERVERNAME>\c$\Program Files\Microsoft System Center\Service Manager 2010\SDK Binaries\


\\<SCSM_SERVERNAME>\c$\Program Files\Microsoft System Center 2012 R2\Service Manager\SDK Binaries\

And copy the following files to the C:\Windows\Assembly directory

You can use the following command (make sure to run powershell as admin)

Get-ChildItem *core*, *service* | Copy-Item -dest C:\Windows\assembly

Register the DLL

Download and Install the SMlets module from the following link:

Once installed, Edit the following file (make sure you do Run As Admin)
C:\Program Files\Common Files\SMLets\Smlets.psm1

Comment the lines 4 to 6:

Comment the line 46 and add the following line
$GLOBAL:smdefaultcomputer = "SCSM_SERVER_FQDN"

Finally we can test to use the SMlets module

# Import the SMlets Module
Import-Module -Name SMLets

# Query an Incident ticket
Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.Incident$) -filter "DisplayName -like 'IR31437*'"

Thanks for reading! If you have any questions, leave a comment or send me an email at fxcat@lazywinadmin.com. I invite you to follow me on Twitter @lazywinadm / Google+ / LinkedIn. You can also follow the LazyWinAdmin Blog on Facebook Page and Google+ Page.

1 comment:

  1. Thanks for posting this, Francois! I decided to try my hand at the first part. Done in under 10 mins!

    "localhost","client" | % {[pscustomobject]@{PSComputerName=$_;Version=(gwmi Win32_OperatingSystem).Version;BuildNumber=(gwmi Win32_OperatingSystem).BuildNumber;SP=(Gwmi win32_operatingsystem).ServicePackMajorVersion;BIOSSerial=(gwmi win32_bios).SerialNumber}} | ft