共用方式為


Get-SCOMMonitor

Retrieves monitors in Operations Manager.

Syntax

Get-SCOMMonitor
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]
Get-SCOMMonitor
   [-DisplayName] <String[]>
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]
Get-SCOMMonitor
   -Id <Guid[]>
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]
Get-SCOMMonitor
   [-Instance] <EnterpriseManagementObject[]>
   [-Recurse]
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]
Get-SCOMMonitor
   [-Recurse]
   [-Target] <ManagementPackClass[]>
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]
Get-SCOMMonitor
   [-ManagementPack] <ManagementPack[]>
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]
Get-SCOMMonitor
   -Name <String[]>
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]

Description

The Get-SCOMMonitor cmdlet retrieves monitors in System Center - Operations Manager. In Operations Manager, monitors define logic for determining the health of an object.

Examples

Example 1: Retrieve a monitor by using a name

PS C:\>Get-SCOMMonitor -Name "System.Health*"

This command retrieves all monitors whose names begin with the string "System.Health".

Example 2: Retrieve a monitor by using a display name

PS C:\>Get-SCOMMonitor -DisplayName "*Performance*"

This command retrieves all monitors whose display names contain the string "Performance".

Example 3: Retrieve monitors for a management pack

PS C:\>Get-SCOMManagementPack -DisplayName "System Center Core Library" | Get-SCOMMonitor

This command retrieves the management pack that has the display name of System Center Core Library, and then passes the management pack object to the Get-SCOMMonitor cmdlet by using the pipeline operator (|). The Get-SCOMMonitor cmdlet gets all monitors for the management pack object.

Example 4: Retrieve monitors from a management pack

PS C:\>$MPFile = "C:\Program Files\System Center Operations Manager 2007\Microsoft.SystemCenter.2007.mp"
PS C:\> Get-SCOMMonitor -ManagementPack $MPFile

This example retrieves monitors in a management pack.

The first command gets the path to a management pack file and stores the value in the variable named $MPFile.

The second command uses the Get-SCOMMonitor cmdlet with the ManagementPack parameter to get the monitors from the management pack.

Example 5: Retrieve monitors by display name

PS C:\>$Instances = Get-SCOMClass -DisplayName "*health*" | Get-SCOMClassInstance
PS C:\> Get-SCOMMonitor -Instance $Instances

This example retrieves monitors by display name.

The first command gets all classes that contain "health" in their display names, and then uses the pipeline operator (|) to pass the class objects to the Get-SCOMClassInstance cmdlet. The Get-SCOMClassInstance cmdlet gets the instance for each class, and then stores the results in the $Instances variable.

The second command gets the monitors for the class instances stored in the $Instances variable.

Example 6: Retrieve monitors by using a target class

PS C:\>Get-SCOMMonitor -Target (Get-SCOMClass -DisplayName *health*)

This example retrieves monitors by using a target class.

This command gets the monitors that have target classes that include "health" in their display names.

Example 7: Retrieve a monitor by using an ID

PS C:\>Get-SCOMMonitor -Id 7413b06b-a95b-4ae3-98f2-dac9ff76dabd

This command retrieves the monitor that has the ID 7413b06b-a95b-4ae3-98f2-dac9ff76dabd.

Parameters

-ComputerName

Specifies an array of names of computers. The cmdlet establishes temporary connections with management groups for these computers. You can use NetBIOS names, IP addresses, or fully qualified domain names (FQDNs). To specify the local computer, type the computer name, localhost, or a dot (.).

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Credential

Specifies a PSCredential object for the computer or computers that the ComputerName parameter specifies. The management group connection runs under this credential. To obtain a PSCredential object, use the Get-Credential cmdlet. For more information, type "Get-Help Get-Credential".

Type:PSCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DisplayName

Specifies an array of display name objects. Values of the DisplayName parameter may vary depending on which localized management packs a user imports into the management group and the locale of the user who is running Windows PowerShell.

Type:String[]
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:True

-Id

Specifies an array of unique identifiers for monitors.

The SCOMMonitor object stores the GUID in the Id property of the object. For more information, type "Get-SCOMMonitor | Format-Table DisplayName, Id".

Type:Guid[]
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Instance

Specifies an array of class instance objects. The Instance parameter also accepts group objects as input. For information about how to get a class instance object, type "Get-Help Get-SCOMClassInstance".

Type:EnterpriseManagementObject[]
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ManagementPack

Specifies one or more management pack objects where you can save the override. If an unsealed management pack contains the monitor, save the override in the same management pack. For information about how to get a management pack object, type "Get-Help Get-SCOMManagementPack".

Type:ManagementPack[]
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specifies an array of names of an object.

Type:String[]
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:True

-Recurse

Indicates that the cmdlet searches recursively.

Type:SwitchParameter
Position:2
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SCSession

Specifies an array of Connection objects. To obtain a Connection object, use the Get-SCManagementGroupConnection cmdlet.

Type:Connection[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Target

Specifies an array of monitors for one or more target class objects. For information about how to get a class object, type "Get-Help Get-SCOMClass".

Type:ManagementPackClass[]
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False