Share via


Update-SCSMSubscription

Update-SCSMSubscription

Updates subscription properties in Service Manager.

Syntax

Parameter Set: Default
Update-SCSMSubscription [-Subscription] <Subscription[]> [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Update-SCSMSubscription cmdlet updates subscription properties in Service Manager.

Parameters

-PassThru

Indicates that this cmdlet returns the subscription that it updates. You can pass this object to other cmdlets.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Subscription<Subscription[]>

Specifies the subscription that this cmdlet updates. To obtain a subscription, use the Get-SCSMSubscription cmdlet.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

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.

  • Microsoft.EnterpriseManagement.ServiceManager.Sdk.Notifications.Subscriptions.Subscription

    You can pipe a subscription to the Subscription parameter.

Outputs

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

  • None.

    This cmdlet does not generate any output.

Examples

Example 1: Update the email template for a subscription

This example updates the email template which is used with the subscription named Subscription01, and adds the woodgrove administrator to the recipient list. The first command displays the subscription that is being updated by using Get-SCSMsubscription.

PS C:\>Get-SCSMsubscription -DisplayName "Subscription01"

The second command gets the subscription that has the specified display name, and then stores it in the $Subscription variable.

The third command gets the user class by using the Get-SCSMClass cmdlet, and then stores it in the $Class variable.

The forth command gets an instance of the class in $Class by using the Get-SCSMClassInstance cmdlet. The command stores the instance in the $User variable.

The fifth command adds a value to the RecipientUsers property of $Subscription.

The final command updates the subscription to match the current value of $Subscription.

PS C:\>$Subscription = Get-SCSMsubscription -DisplayName "Subscription01"
PS C:\> $Subscription.Template = Get-SCSMEmailTemplate "Template2"
PS C:\> $Class = Get-SCCMClass -Name "System.Domain.User"
PS C:\> $User = Get-SCClassInstance -Class $Class -Filter "UserName -eq user"
PS C:\> $Subscription.RecipientUsers += $User.EnterpriseManagementObject
PS C:\> Update-SCSMSubscription -Subscription $Subscription

Get-SCSMSetting

New-SCSMSubscription

Remove-SCSMSubscription