Update-SCSMEmailTemplate

Update-SCSMEmailTemplate

Updates properties of an email template.

Syntax

Parameter Set: Default
Update-SCSMEmailTemplate [-EmailTemplate] <EmailTemplate[]> [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Update-SCSMEmailtemplate cmdlet updates properties of an email template.

Parameters

-EmailTemplate<EmailTemplate[]>

Specifies the email template that this cmdlet updates.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-PassThru

Indicates that this cmdlet returns the email template 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

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

    You can pipe an email template to the EmailTemplate 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 subject of an email template

The first command gets an email template that has the specified display name by using the Get-SCSMEmailTemplate cmdlet. The command stores that template in the $Template variable.

The second command assigns a new value to the Subject property of $Template.

The final command updates the email template to match the current value of $Template.

PS C:\>$Template = Get-SCSMEmailTemplate -DisplayName "Template01"
PS C:\> $Template.Subject = "This is a changed subject for an email template"
PS C:\> Update-SCSMEmailTemplate -EmailTemplate $Template

Example 2: Add a German entry to an email template

The first command gets an email template that has the specified display name, and then stores that template in the $Template variable.

The second command assigns a new value to the TemplateCollection property of $Template. The command adds a German email entry to the current template.

The final command updates the email template to match the current value of $Template.

PS C:\>$Template = Get-SCSMEmailTemplate -DisplayName "Template02"
PS C:\> $Template.TemplateCollection += @{
>> Body = @'
>> Der Windows-Computer wurde aktualisiert
>> ($Context/Property[Type='System!System.Entity']/DisplayName$ 
>> '@
>> Encoding = [Text.Encoding]::Ascii
>> Language = [globalization.cultureinfo]"de-DE"
>> }
PS C:\> Update-SCSMEmailTemplate -EmailTemplate $Template

Get-SCSMEmailTemplate

Get-SCSMEmailTemplateContent

New-SCSMEmailTemplate

Remove-SCSMEmailTemplate