Listing all Linux/Unix Agents in SCOM 2016 (and handling those Square Brackets)

It’s pretty easy to get a list of Windows Agents in SCOM…but Linux and Unix? Well we have a few options at our disposal.

Option 1:

Use the Get-SCXAgent Cmdlet

This is certainly the simplest way to go, but there are other options that give you back more information. But if it’s a simple list you are after, go with the easy method.

Get-SCXAgent

 

Option 2:

We can use Get-SCOMClass and Get-SCOMClassInstance together

Get-SCOMClass -Displayname “UNIX/Linux Computer” | Get-SCOMClassInstance | select *

This will return everything so we can see what sort of information we can retrieve. All standard PowerShell here… except one part…

If we try to retrieve those properties that are enclosed in [Square Brackets]…

Square Brackets

 

then we’ll be disappointed because something like the following command won’t work:

 

Get-SCOMClass -Displayname “UNIX/Linux Computer” | Get-SCOMClassInstance | select DisplayName, IPAddress

Unix IPAddress Blank

As you can see, the IP Address field above is blank…not what we wanted to see.

 

The solution is to double escape the brackets like this:

Get-SCOMClass -Displayname “UNIX/Linux Computer” | Get-SCOMClassInstance | select DisplayName, “[Microsoft.Unix.Computer`].IPAddress

 

And the result…we have our IP Address Returned.

Get-UnixAgents

 

 

Cool, but that heading of [Microsoft.Unix.Computer].IPAddress isn’t very attractive…let’s try this instead.

Get-SCOMClass -Displayname “UNIX/Linux Computer” | Get-SCOMClassInstance | select DisplayName, @{Label=”IP Address”;Expression={$_.'[Microsoft.Unix.Computer].IPAddress’}}

 

And when we run this:

Unix IPAddress Heading

 

We now have a much nicer to read heading.

 

Option 3:

Query the OperationsManager Database:

use OperationsManager
SELECT * FROM ManagedEntityGenericView
INNER JOIN ManagedTypeView ON ManagedEntityGenericView.MonitoringClassId = ManagedTypeView.Id
WHERE (ManagedTypeView.Name = ‘Microsoft.Unix.Computer’)
order by ManagedEntityGenericView.DisplayName

Hope that helps 🙂

 

 

 
Comments

No comments yet.

Leave a Reply