Set-CMAlertSubscription
Set-CMAlertSubscription
Changes the properties of an alert subscription.
Syntax
Parameter Set: SetById
Set-CMAlertSubscription -Id <String> [-AlertId <Int32[]> ] [-EmailAddress <String[]> ] [-LocaleId <Int32> ] [-NewName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: SetByName
Set-CMAlertSubscription -Name <String> [-AlertId <Int32[]> ] [-EmailAddress <String[]> ] [-LocaleId <Int32> ] [-NewName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: SetByValueMandatory
Set-CMAlertSubscription -InputObject <IResultObject> [-AlertId <Int32[]> ] [-EmailAddress <String[]> ] [-LocaleId <Int32> ] [-NewName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: SetSecurityScopeById
Set-CMAlertSubscription -Id <String> -SecurityScopeAction <SecurityScopeActionType> {AddMembership | RemoveMembership} -SecurityScopeName <String> [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: SetSecurityScopeByName
Set-CMAlertSubscription -Name <String> -SecurityScopeAction <SecurityScopeActionType> {AddMembership | RemoveMembership} -SecurityScopeName <String> [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: SetSecurityScopeByValue
Set-CMAlertSubscription -InputObject <IResultObject> -SecurityScopeAction <SecurityScopeActionType> {AddMembership | RemoveMembership} -SecurityScopeName <String> [-Confirm] [-WhatIf] [ <CommonParameters>]
Detailed Description
The Set-CMAlertSubscription cmdlet changes the properties of an alert subscription object in Microsoft System Center 2012 Configuration Manager. You can change the name of an alert subscription, the email address of the recipient of an alert notification, the Windows locale ID, and the alert ID. You can also change the security scope membership of an alert subscription by adding it to or removing it from a specified security scope.
Parameters
-AlertId<Int32[]>
Specifies an array of alert identifiers for the subscription.
Aliases |
AlertIds |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-EmailAddress<String[]>
Specifies an email address where you want to send an alert notification. For example, john.smith@contoso.com. You can separate multiple email addresses by using a semicolon.
Aliases |
EmailAddresses |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-Id<String>
Specifies the identifier for a subscription object.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-InputObject<IResultObject>
Specifies an alert notification object in Configuration Manager.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-LocaleId<Int32>
Specifies a locale for alert messages. For more information and a list of locale identifiers, see the Locale IDs Assigned by Microsoft topic at https://go.microsoft.com/fwlink/?LinkId=262651.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-Name<String>
Specifies the name of an alert subscription object.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-NewName<String>
Specifies a new name for an alert subscription object.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-SecurityScopeAction<SecurityScopeActionType>
Specifies the type of action that the cmdlet takes on an alert subscription object. Valid values are: AddMembership or RemoveMembership.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-SecurityScopeName<String>
Specifies the name of the security scope.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-Confirm
Prompts you for confirmation before running the cmdlet.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
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: Change the properties of an alert subscription by subscription ID
This example changes the name, email address, Windows locale ID, and alert ID of an alert subscription that has the ID 16777217.
PS C:\> Set-CMAlertSubscription –Id "16777217" -NewName "Subscription02" -EmailAddress "john.smith@contoso.com" –LocaleId 2057 –AlertIds 16777240
Example 2: Change the properties of an alert subscription by subscription name
This example changes the name, email address, Windows locale ID, and alert ID of an alert subscription named Subscription01.
PS C:\> Set-CMAlertSubscription -Name "Subscription01" -NewName "Subscription02" -EmailAddress "sarah.jones@contoso.com" -LocaleId 2057 –AlertIds 16777240
Example 3: Change the properties of an alert subscription by using the output from another cmdlet as input
In this example, the first command gets an alert subscription object that has the ID 16777310 and stores the object in the $SubObj variable.
The second command changes the properties of the alert subscription object (the subscription name, email recipient, locale ID, and alert ID) for the alert notification stored in the $SubObj variable.
PS C:\> $SubObj = Get-CMAlertSubscription -Id "16777310"
PS C:\> Set-CMAlertSubscription -AlertSubscription $SubObj -NewName "Subscription02" -EmailAddress "thomas.andersen@contoso.com" -LocaleId 3081 –AlertIds 16777240
Example 4: Add an alert subscription to a security scope
This example adds the alert subscription named Subscription01 to the security scope named Test.
PS C:\> Set-CMAlertSubscription -SecurityScopeAction AddMembership -SecurityScopeName "Test" -Name "Subscription01"
Example 5: Remove an alert subscription from a security scope
This example removes the alert subscription named Subscription01 from the security scope named Test.
PS C:\> Set-CMAlertSubscription -SecurityScopeAction RemoveMembership -SecurityScopeName "Test" -Name "Subscription01"