New-MonitoringPropertyValuePair

New-MonitoringPropertyValuePair

Creates a new monitoring property-value pair object.

Syntax

Parameter Set: FromMonitoringClass
New-MonitoringPropertyValuePair [-MonitoringClassProperty] <MonitoringClassProperty> [-PropertyValue] <Object> [ <CommonParameters>]

Detailed Description

Creates a new monitoring property-value pair object. You use these objects when you create custom monitoring objects by using New-CustomMonitoringObject.

Parameters

-MonitoringClassProperty<MonitoringClassProperty>

Specifies the property.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-PropertyValue<Object>

Specifies the value of the property.

Aliases

none

Required?

true

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 New-MonitoringPropertyValuePair -detailed". For technical information, type "Get-Help New-MonitoringPropertyValuePair -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-MonitoringClass to retrieve a reference to the class Microsoft.Windows.Computer. It stores it in the $monitoringclass variable. It then uses Get-MonitoringClassProperty to retrieve a reference to the PrincipalName property and stores it in the $prop variable. Last, it uses New-MonitoringClassPropertyValuePair to create a property-value pair with the property PrincipalName and the value computer1.contoso.com.

C:\PS>$monitoringclass = get-monitoringclass -name 'Microsoft.Windows.Computer'
$prop = get-monitoringclassproperty -monitoringclass $monitoringclass | where-object {$_.Name -eq 'PrincipalName'}
$value = new-monitoringpropertyvaluepair `
-monitoringclassproperty $prop -propertyvalue 'computer1.contoso.com'

New-CustomMonitoringObject