Remove-SCSMEmailTemplate

Removes an email template from Service Manager.

Syntax

Remove-SCSMEmailTemplate [-EmailTemplate] <EmailTemplate[]> [-Confirm] [-WhatIf] [<CommonParameters>]

Description

The Remove-SCSMEmailTemplate cmdlet removes an email template from Service Manager.

Examples

Example 1: Remove all email templates that match a display name string

PS C:\>Get-SCSMEmailTemplate | Where-Object { $_.displayname -match "custom" } | Remove-SCSMEmailTemplate

This command removes all email templates where the DisplayName property matches the string custom. The command gets all email templates by using the Get-SCSMEmailTemplate cmdlet. The command passes the results to the Where-Object cmdlet by using the pipeline operator. That cmdlet passes on only the results that match the display name to the current cmdlet. That cmdlet deletes each template.

Example 2: Remove all email templates that match a description string

PS C:\>$Templates = Get-SCSMEmailTemplate | Where-Object {$_.Description -match "notification"}
PS C:\> Remove-SCSMEmailTemplate -EmailTemplate $Templates

The first command uses Get-SCSMEmailTemplate to get all email templates, and passes them to Where-Object. The command stores all the objects that match the Description property as specified in the $Templates variable.

The second command remove all templates in $Templates.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Required:False
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-EmailTemplate

Specifies an object that represents the email template to be removed.

Type:EmailTemplate[]
Required:True
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Required:False
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.EnterpriseManagement.ServiceManager.Sdk.Notifications.EmailTemplate

You can pipe an email template to the *EmailTemplate* parameter.

Outputs

None.

This cmdlet does not generate any output.