Share via


Remove-SCSMEmailTemplate

Removes an email template from Service Manager.

Syntax

Default (Default)

Remove-SCSMEmailTemplate
    [-EmailTemplate] <EmailTemplate[]>
    [-WhatIf]
    [-Confirm]
    [<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.

Parameter properties

Type:System.Management.Automation.SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EmailTemplate

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

Parameter properties

Type:

Microsoft.EnterpriseManagement.ServiceManager.Sdk.Notifications.EmailTemplate[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:System.Management.Automation.SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

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.