Skip to content

Get queue members for SCSM 2010 and 2012

Get queue members for SCSM 2010 and 2012 published on 4 Comments on Get queue members for SCSM 2010 and 2012

Sometimes you need to know which objects contain the queue. This can be done easy with PowerShell.

For SCSM 2010 (or for SCSM 2012 with SMLets installed):

param ([string]$QueueDisplayName)
import-module SMLets

$queueObj = Get-SCSMObject -Class (Get-SCSMClass -Name "System.WorkItemGroup") -Filter "DisplayName = '$QueueDisplayName'"

$rel = Get-SCSMRelationshipClass | ?{$_.Source.Class.Name  -eq $queueObj.ClassName }

Get-SCSMRelatedObject $queueObj -Relationship $rel 

For SCSM 2012 native cmdlets:

param([string]$QueueDisplayName)
Import-Module 'C:\Program Files\Microsoft System Center\Service Manager 2012\Powershell\System.Center.Service.Manager.psd1'

$queueObj = Get-SCSMQueue -DisplayName $QueueDisplayName
$rel = Get-SCSMRelationship | ?{$_.Source.Type.Id  -eq $queueObj.EnterpriseManagementObject.Id }
$queueObj.GetRelatedObjectsWhereSource($rel.Id)

Save that script as Get-SCSMQueueMembers.ps1, and when you can use it like this:

.\Get-SCSMQueueMembers.ps1 "All Critical Incidents"

Share

4 Comments

Leave a Reply

Primary Sidebar

%d bloggers like this: