Add-SCOMNotificationSubscription

Add-SCOMNotificationSubscription

Adds a notification subscription.

Syntax

Parameter Set: Default
Add-SCOMNotificationSubscription [-Name] <String> [[-Criteria] <String> ] -Channel <Object[]> -Subscriber <NotificationRecipient[]> [-BccSubscriber <NotificationRecipient[]> ] [-CcSubscriber <NotificationRecipient[]> ] [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-Delay <TimeSpan> ] [-Description <String> ] [-Disabled] [-DisplayName <String> ] [-OnlyOnResolutionChange] [-PollingInterval <TimeSpan> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Detailed Description

The Add-SCOMNotificationSubscription cmdlet adds a notification subscription in System Center 2012 – Operations Manager.

In this release there is no cmdlet support for scoping subscriptions based on criteria, but you can access System Center Operations Manager (SCOM) SDK through Windows PowerShell to achieve this result.

Parameters

-BccSubscriber<NotificationRecipient[]>

Specifies an array of subscribers to blind carbon copy (BCC) on a message for a subscription.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-CcSubscriber<NotificationRecipient[]>

Specifies an array of subscribers to carbon copy (CC) on a message for a subscription.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Channel<Object[]>

Specifies an array of notification channels. To obtain a notification channel object, use the Get-SCOMNotificationChannel cmdlet.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-ComputerName<String[]>

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 (.).

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Credential<PSCredential>

Specifies a PSCredential object for the management group connection. To obtain a PSCredential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Criteria<String>

Specifies the criteria XML that indicates how to filter alerts for this subscription. Criteria can filter on particular rules or monitors, or properties of the alert, but cannot filter on classes or groups.

You can manually copy the criteria XML from an existing subscription. To obtain the criteria XML from an existing subscription, use this model: $Subscription = Get-SCOMNotificationSubscription | Select-Object -First 1 $Criteria = $Subscription.Configuration.Criteria.

Aliases

none

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Delay<TimeSpan>

Specifies a delay, in HH:MM:SS, for sending notifications if conditions remain unchanged for this period of time. By default, Operations Manager sends notifications immediately.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Description<String>

Specifies a description for the notification subscription. If you do not specify a description, the parameter defaults to the value of the DisplayName parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Disabled

Indicates that this cmdlet creates a subscription but leaves it in a disabled state.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DisplayName<String>

Specifies a display name for the subscription. If you do not specify a description, the parameter defaults to the value of the Name parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Name<String>

Specifies a name for the subscription.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-OnlyOnResolutionChange

Indicates that this cmdlet only sends a notification when the resolution state of the alert changes.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-PollingInterval<TimeSpan>

Specifies a polling interval for alerts. If you do not specify this parameter, the interval defaults to one minute.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-SCSession<Connection[]>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Subscriber<NotificationRecipient[]>

Specifies an array of subscribers for this subscription. To obtain a notification subscriber object, use the Get-SCOMNotificationSubscriber cmdlet.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Add a notification subscription

This example adds a new notification subscription for all alerts.

The first command uses the Get-SCOMNotificationSubscriber cmdlet to get subscribers and stores the result in the $Subscriber variable.

The second command uses the Get-SCOMNotificationChannel cmdlet to get the notification channel, and stores the result in the $Channel variable.

The third command uses the Add-SCOMNotificationSubscription cmdlet with the Name, Subscriber, and Channel parameters.

PS C:\> $Subscriber = Get-SCOMNotificationSubscriber -Name "Elisa Daugherty","Patti Fuller"
PS C:\> $Channel = Get-SCOMNotificationChannel -DisplayName "EmailChannel"
PS C:\> Add-SCOMNotificationSubscription -Name "NewSubscription1" -Subscriber $Subscriber -Channel $Channel

Example 2: Add a notification subscription with conditions

This example adds a new notification subscription for all alerts, but only sends a notification if conditions remain unchanged for one hour. The example creates the subscription in the disabled state.

The first command uses the Get-SCOMNotificationSubscriber cmdlet to get subscribers and stores the result in the $Subscriber variable.

The second command uses the Get-SCOMNotificationChannel cmdlet to get the notification channel, and stores the result in the $Channel variable.

The third command uses the Add-SCOMNotificationSubscription cmdlet with the Name, Subscriber, and Channel parameters.

PS C:\> $Subscriber = Get-SCOMNotificationSubscriber -Name "Evan Narvaez","David Chew"
PS C:\> $Channel = Get-SCOMNotificationChannel -DisplayName "EmailChannel"
PS C:\> Add-SCOMNotificationSubscription -Name "NewSubscription2" -Subscriber $Subscriber -Channel $Channel -Delay "1:00:00" -Disabled

Example 3: Add a new subscription for instances of a specific class

This example adds a new notification subscription for all alerts and then uses the Operations Manager SDK to scope the subscription to alerts raised by instances of the HealthService class.

The first command uses the Get-SCOMNotificationSubscriber cmdlet to get subscribers and stores the result in the $Subscriber variable.

The second command uses the Get-SCOMNotificationChannel cmdlet to get the notification channel, and stores the result in the $Channel variable.

The third command uses the Add-SCOMNotificationSubscription cmdlet with the Name, Subscriber, and Channel parameters. The cmdlet stores the result in the $Subscription variable.

The fourth command uses the Get-SCOMClass cmdlet and stores the result in the $HealthService variable.

The fifth command uses the Add method with the ID of the $HealthService variable.

The sixth command uses the Update method.

PS C:\> $Subscriber = Get-SCOMNotificationSubscriber -Name "Patti Fuller", "Elisa Daugherty"
PS C:\> $Channel = Get-SCOMNotificationChannel -DisplayName "EmailChannel"
PS C:\> $Subscription = Add-SCOMNotificationSubscription -Name "NewSubscription3" -Subscriber $Subscriber -Channel $Channel
PS C:\> $HealthService = Get-SCOMClass -Name "Microsoft.SystemCenter.HealthService"
PS C:\> $Subscription.Configuration.MonitoringClassIds.Add( $HealthService.Id )
PS C:\> $Subscription.Update()

Example 4: Add a notification subscription by using the SDK

This example adds a new notification subscription for all alerts, and then uses the Operations Manager SDK to scope the subscription to alerts raised by instances in the All Windows Computers group.

The first command uses the Get-SCOMNotificationSubscriber cmdlet to get subscribers and stores the result in the $Subscriber variable.

The second command uses the Get-SCOMNotificationChannel cmdlet to get the notification channel, and stores the result in the $Channel variable.

The third command uses the Add-SCOMNotificationSubscription cmdlet with the Name, Subscriber, and Channel parameters. The cmdlet stores the result in the $Subscription variable.

The fourth command uses the Get-SCOMGroup cmdlet to get the All Windows Computers group, and stores the result in the $WindowsComputers variable.

The fifth command uses the Add method with the Id of the $WindowsComputers variable.

The sixth command uses the Update method.

PS C:\> $Subscriber = Get-SCOMNotificationSubscriber -Name "Patti Fuller","David Chew"
PS C:\> $Channel = Get-SCOMNotificationChannel -DisplayName "EmailChannel"
PS C:\> $Subscription = Add-SCOMNotificationSubscription -Name "NewSubscription4" -Subscriber $Subscriber -Channel $Channel
PS C:\> $WindowsComputers = Get-SCOMGroup -DisplayName "All Windows Computers"
PS C:\> $Subscription.Configuration.MonitoringObjectGroupIds.Add( $WindowsComputers.Id )
PS C:\> $Subscription.Update()

Example 5: Add a notification subscription for a specific monitor

This example adds a new notification subscription for all critical alerts raised by the monitor that has the display name ContosoMonitor.

The first command uses the Get-SCOMNotificationSubscriber cmdlet to get subscribers and stores the result in the $Subscriber variable.

The second command uses the Get-SCOMNotificationChannel cmdlet to get the notification channel, and stores the result in the $Channel variable.

The third command uses the Get-SCOMMonitor cmdlet and stores the result in the $Monitor variable.

The fourth command stores the XML criteria in the $Criteria variable.

The fifth command uses the Add-SCOMNotificationSubscription cmdlet with the Name, Subscriber, Channel, and Criteria parameters.

PS C:\> $Subscriber = Get-SCOMNotificationSubscriber -Name "Evan Narvaez", "Elisa Daugherty"
PS C:\> $Channel = Get-SCOMNotificationChannel -DisplayName "EmailChannel"
PS C:\> $Monitor = Get-SCOMMonitor -DisplayName "ContosoMonitor"
PS C:\> $Criteria = @"
>><And xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>><Expression>
>><SimpleExpression>
>><ValueExpression>
>><Property>ProblemId</Property>
>></ValueExpression>
>><Operator>Equal</Operator>
>><ValueExpression>
>><Value>$($monitor.Id)</Value>
>></ValueExpression>
>></SimpleExpression>
>></Expression>
>><Expression>
>><SimpleExpression>
>><ValueExpression>
>><Property>Severity</Property>
>></ValueExpression>
>><Operator>Equal</Operator>
>><ValueExpression>
>><Value>2</Value>
>></ValueExpression>
>></SimpleExpression>
>></Expression>
>>"@
PS C:\> Add-SCOMNotificationSubscription -Name "Subscription03" -Subscriber $Subscriber -Channel $Channel -Criteria $Criteria

Disable-SCOMNotificationSubscription

Enable-SCOMNotificationSubscription

Get-SCOMNotificationSubscription

Remove-SCOMNotificationSubscription

Get-SCOMNotificationChannel

Get-SCOMManagementGroupConnection