Wednesday, 15 September 2010

List current values for a list enumeration in Service Manager

Credit goes to Patrik for this forum post.

Create a powershell script containing the following:

-------------

function getChildren([Microsoft.EnterpriseManagement.Configuration.ManagementPackEnumeration]$parent)
{
$outPut = "$outPut - " + $parent.DisplayName
Write-host $outPut

Foreach ($child in Get-SCSMEnumeration?{$_.Parent -eq $parent})
{
getChildren $child
}
}

Import-module smlets
$rootEnumElementName = 'ChangeAreaEnum$'
$parent = Get-SCSMEnumeration -Name $rootEnumElementName -ComputerName Servername|?{$_.Parent -eq $enum}

getChildren $parent

----------------

Change the 'ChangeAreaEnum$' to reflect the root element of your custom lists internal name (you should leave the dollar sign on the end). Also change the ServerName in the script to match your SCSM server name.

To get this, run the following command in PowerShell:
Get-SCSMEnumeration|?{$_.DisplayName -eq 'Incident Classification'}

Change the 'Incident Classification' to the name of your list as shown in the Service Manager console.

2 comments:

Konstantin Slavin-Borovskij said...

Hey Steve,

Nice write-up, helped me solve a problem.

A small syntax error in your Foreach-loop: You're missing a pipe before the question mark.

Thanks again.

Anonymous said...

Good job and many thanks for your effort.

Now how can export the result in CSV file?