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.

No comments:

Post a Comment