If you are like me, you like to find any way possible to leverage powershell to help with tasks that are either tedious or just not possible through a console. One such task is the creation of CIs in Service Manager. If you google this with Bing you will quickly come up with search results for CSV Import and 3rd party tools like Provance’s Data Management Pack and Cireson’s Asset Import. I have spent quite some time digging for a powershell only solution on the interwebs, but, I came up with nothing. So I did some digging within the native Service Manager cmdlets and behold what I found:

  • New-SCSMClassInstance (Alias)
  • Update-SCSMClassInstance (cmdlet)

Nice! And we didn’t even have to break open the SMLets! Here is an example of both commands used in action….

Creating a new CI


$smclass = get-scsmclass -name ‘contoso.vmware.host’

new-scsmclassinstance -class $smclass -property @{

HostId = $vmhost.id;

DisplayName = $vmhost.name;

ClusterName = $clusterName;

DatacenterName = $Datacenter.name;

vCenterName = $vcenter;

TotalCpuMhz = $TotalCpu;

TotalMemoryGB = $TotalMemory



Update an existing CI


Get-SCSMClass –name "contoso.vmware.host" | Get-SCSMClassInstance | ?{$_.DisplayName –eq "Host1"} | %{$_.UtlizationCPU = 22 ; $_.UtilizationMemory = 55 ; $_} | Update-SCSMClassInstance


Now I have one of the building blocks down for quickly and easily creating CIs within Service Manager using Powershell. Next up, how to create type projections and relationships using Powershell? I’ll get back to you all on that! J