New-SCSMEmailTemplate
Creates a new Email template for Service Manager.
Syntax
New-SCSMEmailTemplate
[-Body <String>]
[-Subject <String>]
[-Language <CultureInfo>]
[-TemplateCollection <Hashtable[]>]
[-Encoding <Encoding>]
-Class <ManagementPackClass>
[-Description <String>]
[-ManagementPack <ManagementPack>]
-DisplayName <String>
[-SendAsHtml]
[-Urgency <EmailTemplateUrgency>]
[-PassThru]
[-SCSession <Connection[]>]
[-ComputerName <String[]>]
[-Credential <PSCredential>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The New-SCSMEmailTemplate cmdlet creates an email template for Service Manager.
Examples
Example 1: Create an email template for a change to a printer
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:\> $ManagementPack = Get-SCSMManagementPack -Name "ServiceManager.ConfigurationManagement.Configuration"
PS C:\> $Language = [System.Globalization.CultureInfo]"en-US"
PS C:\> $Encoding = [System.Text.Encoding]::ASCII
PS C:\> New-SCSMEmailTemplate -Class $PrinterClass -DisplayName "Printer Email Template" -Body $Message -Description "A template for printer notifications" -Encoding $Encoding -Language $Language -ManagementPack $ManagementPack -Subject $Message
The first command gets a class named Microsoft.AD.Printer by using the Get-SCSMClass cmdlet, and then stores it in the $PrinterClass variable.
The second command creates a message for the email, and stores it in the $Message variable. This example uses the same string as the subject and the body of the email.
The third command gets a management pack in which to save this template by using the Get-SCSMManagementPack cmdlet, and then stores it in the $ManagementPack variable.
The fourth and fifth commands store values for language and encoding in the $Language and $Encoding variables.
The final command creates an email template that applies when a change occurs to a printer. The command uses values that were created in the first five commands.
Parameters
-Body
Specifies the message body, which can include insertion strings.
Type: | System.String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Class
Specifies the name of the class that the email template targets.
Type: | Microsoft.EnterpriseManagement.Configuration.ManagementPackClass |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ComputerName
Specifies the name of the computer on which the System Center Data Access service runs. The user account that is specified in the Credential parameter must have access rights to the specified computer.
Type: | System.String[] |
Position: | Named |
Default value: | Localhost |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | System.Management.Automation.SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Credential
Specifies the credentials that this cmdlet uses to connect to the server on which the System Center Data Access service runs. The specified user account must have access rights to that server.
Type: | System.Management.Automation.PSCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Description
Specifies a description for the email template.
Type: | System.String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DisplayName
Specifies the name of the email template.
Type: | System.String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Encoding
Specifies the encoding to be used in the message.
Type: | System.Text.Encoding |
Position: | Named |
Default value: | Unicode (UTF-8) |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Language
Specifies the language for the message.
Type: | System.Globalization.CultureInfo |
Position: | Named |
Default value: | English (United States) |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ManagementPack
Specifies the name of the management pack in which this cmdlet stores the email template.
Type: | Microsoft.EnterpriseManagement.Configuration.ManagementPack |
Position: | Named |
Default value: | The default management pack |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PassThru
Indicates that this cmdlet returns the email template that it creates. You can pass this object to other cmdlets.
Type: | System.Management.Automation.SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SCSession
Specifies an object that represents the session to a Service Manager management server.
Type: | Microsoft.SystemCenter.Core.Connection.Connection[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SendAsHtml
Specifies that this cmdlet causes the email to be sent as HTML.
Type: | System.Management.Automation.SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Subject
Specifies the subject for the email message.
Type: | System.String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-TemplateCollection
Specifies a collection of hash tables which represent the email template. The hash table must have the following keys:
- Body. This is a string which represents the body of the template.
- Subject. This is a string which represents the subject of the email.
- Language. This must be of type CultureInfo. It represents the language for the message. If you specify multiple hash tables, you cannot use the same value for Language.
Type: | System.Collections.Hashtable[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Urgency
Specifies the urgency of the email message. Valid values are:
- High
- Medium
- Low
Type: | Microsoft.EnterpriseManagement.ServiceManager.Sdk.Notifications.EmailTemplateUrgency |
Accepted values: | Low, Medium, High |
Position: | Named |
Default value: | Medium |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | System.Management.Automation.SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
None.
You cannot pipe input to this cmdlet.
Outputs
None.
This cmdlet does not generate any output.