I have been doing quite a bit of DevOps work lately and I received a request the other day that might be worth sharing.
Our SCSM Administrator needed to get an export of our current categories, and he had found a script online to do so; however, it was only hard coded to go 3 levels deep and our categories would go much deeper than that. . He asked me if I could take a look into why this was happening, and it turned out that the way that the script works is that it was only hard coded to go 3 levels deep, so I wrote a function to recursively go through the main class, and its children and print out the categories regardless of the levels that you might have.
foreach($obj in $listObjects)
$id = $obj.id
"$("`t"*$count) - $($obj.DisplayName)" | Out-File 'C:\FILE\PATH.txt' -Append
$children = Get-SCSMEnumeration -ComputerName $scsm | ? Parent -match $id
if($children -ne $null)
get-childLists $children, $listName
$scsm = 'YOURSCSMSERVER'
$areas = @("ActivityAreaEnum",
foreach($list in $areas)
$count = -1
$enumLists = Get-SCSMEnumeration -ComputerName $scsm | ? Name -eq $list
Let me know what you think, and if you all find this useful then I can probably make it into an actual advance function.