다음을 통해 공유


Remove-SCSMEmailTemplate

Remove-SCSMEmailTemplate

Removes an email template from Service Manager.

Syntax

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

Detailed Description

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

Parameters

-EmailTemplate<EmailTemplate[]>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

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: Remove all email templates that match a display name string

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.

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

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

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.

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

Get-SCSMEmailTemplate

Get-SCSMEmailTemplateContent

New-SCSMEmailTemplate

Update-SCSMEmailTemplate

Where-Object