Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

New-SCSMSubscription

Updated: November 1, 2013

Applies To: System Center 2012 - Service Manager, System Center 2012 R2 Service Manager, System Center 2012 SP1 - Service Manager

New-SCSMSubscription

Creates a new subscription in Service Manager.

Syntax

Parameter Set: Default
New-SCSMSubscription -Class <ManagementPackClass> -DisplayName <String> -Recipient <EnterpriseManagementObject[]> -Template <EmailTemplate> [-ComputerName <String[]> ] [-Condition <Condition> ] [-Credential <PSCredential> ] [-Criteria <String> ] [-Description <String> ] [-Enable <Boolean> ] [-GroupQueue <String[]> ] [-ManagementPack <ManagementPack> ] [-PassThru] [-SCSession <Connection[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]




Detailed Description

The New-SCSMSubscription cmdlet creates a new subscription in Service Manager.

Parameters

-Class<ManagementPackClass>

Specifies the name of the class that the subscription targets. The specified name must reference the same class that is referenced by the specified email template.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ComputerName<String[]>

Specifies the name of the computer on which the System Center Data Access service is running. The user account that is defined in the Credential parameter must have access rights to the specified computer.


Aliases

none

Required?

false

Position?

named

Default Value

localhost

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Condition<Condition>

Specifies the condition under which the subscription will execute. Allowed values are Created, Updated, or Deleted.


Aliases

none

Required?

false

Position?

named

Default Value

Updated

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Credential<PSCredential>

Specifies the credentials to use when you connect to the server on which the System Center Data Access service is running. The provided user account must have access to that server.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Criteria<String>

Specifies the XML criteria which the subscription will use. If both Filter and Criteria are specified, only the Criteria will be used.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Description<String>

Describes the subscription.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DisplayName<String>

Specifies the display name of the subscription.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Enable<Boolean>

Enables the connector.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-GroupQueue<String[]>

Specifies a group or a queue to set a limit on the number of objects that the subscription tracks.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ManagementPack<ManagementPack>

Specifies the name of the management pack in which the new subscription will be stored.


Aliases

none

Required?

false

Position?

named

Default Value

The default management pack

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PassThru

Specifies the output object that represents the new subscription. This output object can be passed to other cmdlets.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Recipient<EnterpriseManagementObject[]>

Specifies the list of users to whom email will be sent.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SCSession<Connection[]>

Represents the session to a Service Manager management server.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Template<EmailTemplate>

Specifies the name of an Email template.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before executing the command.


Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Describes what would happen if you executed the command without actually executing the command.


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.

Inputs

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

  • None.

    You cannot pipe input to this cmdlet.


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 --------------------------

This command creates a new email template for printer changes. It then uses that template to create a subscription, which sends an email to the administrator anytime a printer is updated.


PS C:\> $printerClass = get-scsmclass -Name Microsoft.AD.Printer
PS C:\>$message = 'Printer $Context/Property[''Type=Windows!Microsoft.AD.Printer'']/PrinterName$ has been updated'
PS C:\>$mp = Get-SCSMManagementPack -name ServiceManager.ConfigurationManagement.Configuration
PS C:\>$language = [System.Globalization.CultureInfo]"EN"
PS C:\>$encoding = [System.Text.Encoding]::ASCII
PS C:\>$emailTemplateArgs = @{
>>  Class = $printerClass
>>  Subject = $message
>>  Body = $message
>>  ManagementPack = $mp
>>  Language = $language
>>  Encoding = $encoding
>>  DisplayName = "Printer Email Template"
>>  Description = "A template for printer notifications"
>>  }
PS C:\>New-SCSMEmailTemplate @emailTemplateArgs
PS C:\>$printertemplate = Get-SCSMEmailTemplate -DisplayName "Printer Email Template"
PS C:\>$userClass = get-scsmclass -name Microsoft.AD.user
PS C:\>$recipient = Get-SCSMClassInstance -class $userClass -filter 'UserName -like "%Administrator"'
PS C:\>$subscriptionArgs = @{
>>  Class = $printerClass
>>  Condition = "Updated"
>>  Recipient = $recipient
>>  Template = $printerTemplate
>>  DisplayName = "Printer update subscription"
>>  }
PS C:\>New-SCSMSubscription @subscriptionArgs

-------------------------- EXAMPLE 2 --------------------------

This command creates a new Email notification subscription that is configured to send Email to the domain administrators. The new subscription is based on changes in the Printer class, where the location has changed.


PS C:\> $Criteria = @'
>>  <Criteria>
>>  <Expression>
>>  <SimpleExpression>
>>  <ValueExpression>
>>  <Property State="Pre">$Context/Property[Type='Windows!Microsoft.AD.Printer']/Location$</Property>
>>     </ValueExpression>
>>    <Operator>NotEqual</Operator>
>>    <ValueExpression>
>>      <Property State="Post">$Context/Property[Type='Windows!Microsoft.AD.Printer']/Location$</Property>
>>     </ValueExpression>
>>    </SimpleExpression>
>>   </Expression>
>>  </Criteria>
>>  @'
PS C:\>$Recipient = get-scsmclassinstance –displayname System.User -filter "Name -like 'domain admins'"
PS C:\>$SubscriptionArguments = @{
>>  DisplayName = "A printer subscription"
>>  Description = "Changes in the printer location will cause email to be sent"
>>  Class = Get-SCSMClass -Displayname Microsoft.AD.Printer
>>  Condition = "Updated"
>>  Criteria = $Criteria
>>  Template = Get-SCSMEmailTemplate -Displayname StandardEmailTemplate
>>  Recipient = $Recipient
>>  }
PS C:\>New-SCSMSubscription @SubscriptionArguments

Related topics

 
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.