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"
4 Comments
Thanks, Anton, I remember you telling me about this the other month, it was very useful for troubleshooting a queue problem just now.
Hi Anton, do you have an example SCSM 2010 to add multiple relationships (new-scsmrelationshipobject -nocommit) in one step. To create only one Changeliste/history log, for instance add manay users to a group as relation?
[…] HR queue or the DEV queue. If you want to verify that you can use the following script. Thanks to Anton Gritsenko who wrote this script. When the incident is in the queue the SLO will be applied too. It can take a […]
[…] the good charity of a good soul in the web, I found this script (thanks to Anton) that will show the members of a certain […]