Search This Blog

Thursday 26 February 2015

Get-SCOMGroup List of Computers


As of 01/05/2017, this blog will not be updated or maintained

Sometimes you just want to get a list of computers that are members of a group, and just want their names. This is pretty easy using the cmdlet Get-SCOMGroup, just use the –DisplayName switch and add the name of the group and pipe it to the cmdlet Get-SCOMClassInstance.

To see what options are available at this point pipe it Get-Member and you will see a nice list of properties/methods available to the object in the pipe line.

An Important Note to make at this point, what is in the pipeline right now are objects, and can still be massaged with PowerShell very easily. So you could sort by DisplayName and then just dump it out to a table just showing display name.

Examples of what is described above:


# To load the opsmgr cmdlets, import the module first
Import-Module OperationsManager

# To find out what options are available to your output of the list of objects in the group use Get-Member cmdlet
Get-SCOMGroup -DisplayName "Your_Computer_Group_Name" | Get-SCOMClassInstance | Get-Member

# After looking at the Get-Member output we decide that DisplayName will work best
Get-SCOMGroup -DisplayName "Your_Computer_Group_Name" | Get-SCOMClassInstance | Sort DisplayName | Format-Table DisplayName

This is an easy way to get a list of computers that are members of a group. Something that I need to do quite frequently these days.

Hope that this post was helpful.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.