Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

get-monitoringobjectgroup unable to use where DisplayName

90 views
Skip to first unread message

Justin Cook

unread,
Jun 30, 2009, 1:01:01 AM6/30/09
to

Hey Guys,

I am trying to return the heath state of a particular group in Ops Mgr which
is used by SaVision Live Maps. I want to use this in a monitor so that an
alert can be generated when an object on the map changes. When I use the
below command in PowerShell, I get all the groups in the management group and
their health state:

get-monitoringobjectgroup | ft DisplayName, HealthState

I want to filter this to one particular group at a time, when I use the
following command, I get no results:

get-monitoringobjectgroup | ft DisplayName, HealthState | where
{$_.DisplayName -eq "TRIM"}

I can use the where clause with DisplayName against the get-monitoringobject
cmdlet but not the get-monitoringobjectgroup cmdlet. Maybe this is a bug in
the get-monitoringobjectgroup cmdlet. The DisplayName property is definitely
right, because I can use it with the format-table command.

Any help is greatly appreciated. Thanks,
Justin

Marco Shaw [MVP]

unread,
Jun 30, 2009, 11:07:51 PM6/30/09
to

Once you pipe something to Format-Table, you've changed the type of object
you're dealing with. Format-* cmdlets should always be the last cmdlet used
in a pipeline.

You should be doing:
get-monitoringobject|where{$_.displayname -eq "trim"}|ft
displayname,healthstate

Marco

"Justin Cook" <Justi...@discussions.microsoft.com> wrote in message
news:B6C2B4F1-99E3-46E0...@microsoft.com...

Justin Cook

unread,
Jul 1, 2009, 9:08:01 PM7/1/09
to

Forgetting the format-table command, the cmdlet get-monitoringobjectgroup
fails to return any data when you specify displayname in the where clause. If
I leave the where clause out, it returns all group objects and the
DisplayName is definitely there.

Marco Shaw [MVP]

unread,
Jul 1, 2009, 9:16:17 PM7/1/09
to

Ah! I never noticed this was for get-...group. I see the problem now.

Try this:
PS>get-monitoringobjectgroup|gm

This is a .NET collection. I'll need to do a little big of digging to see
how to unpack this (if I can)...

Marco

"Justin Cook" <Justi...@discussions.microsoft.com> wrote in message

news:50FD6D51-2AAE-4FCE...@microsoft.com...

Marco Shaw [MVP]

unread,
Jul 2, 2009, 9:35:33 PM7/2/09
to

It was easier than I remembered:
PS>Get-MonitoringObjectGroup|foreach{$_.GetEnumerator()}|where{$_.DisplayName
-eq "TRIM"}

Marco

"Marco Shaw [MVP]" <marco.shaw@NO_SPAMgmail.com> wrote in message
news:O0e#uKr#JHA....@TK2MSFTNGP03.phx.gbl...

0 new messages