Get-State

Get-State

Gets monitoring state for specified monitoring objects.

Syntax

Parameter Set: FromMonitoringObjectProviderPath
Get-State [[-Path] <String[]> ] [ <CommonParameters>]

Parameter Set: FromMonitoringObject
Get-State [-MonitoringObject] <MonitoringObject> [ <CommonParameters>]

Detailed Description

Gets health state for specified monitoring objects.

Parameters

-MonitoringObject<MonitoringObject>

Specifies the monitoring object for which to retrieve health state.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Path<String[]>

Specifies paths to monitoring objects for which to retrieve health state. To enter multiple values, separate each by using commas.

Aliases

none

Required?

false

Position?

2

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters

Notes

  • For more information, type "Get-Help Get-State -detailed". For technical information, type "Get-Help Get-State -full".
    When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".

Examples

-------------- EXAMPLE 1 --------------

This command uses Get-State to retrieve the health state of the monitoring objects associated with the current path. It passes the results along the pipeline to Select-Object which selects and displays the Object Name, MonitorDisplayName and HealthState. The Object Name is retrieved by using Get-MonitoringObject and advanced syntax supported by Select-Object.

C:\PS>get-state |
select-object @{Name="Object Name";Expression= `
{ foreach-object `
{(get-monitoringobject -id $_.monitoringobjectid).DisplayName}}}, ` monitordisplayname,healthstate

Get-MonitoringObject