New-SCSMEmailTemplate

New-SCSMEmailTemplate

Creates an email template for Service Manager.

構文

Parameter Set: Default
New-SCSMEmailTemplate -Class <ManagementPackClass> -DisplayName <String> [-Body <String> ] [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-Description <String> ] [-Encoding <Encoding> ] [-Language <CultureInfo> ] [-ManagementPack <ManagementPack> ] [-PassThru] [-SCSession <Connection[]> ] [-SendAsHtml] [-Subject <String> ] [-TemplateCollection <Hashtable[]> ] [-Urgency <EmailTemplateUrgency> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

詳細説明

The New-SCSMEmailTemplate cmdlet creates an email template for Service Manager.

パラメーター

-Body<String>

Specifies the message body, which can include insertion strings.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Class<ManagementPackClass>

Specifies the name of the class that the email template targets.

エイリアス

なし

必須?

true

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-ComputerName<String[]>

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.

エイリアス

なし

必須?

false

位置は?

named

既定値

localhost

パイプライン入力を許可する

true (ByValue)

ワイルドカード文字を許可する

false

-Credential<PSCredential>

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.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

true (ByValue)

ワイルドカード文字を許可する

false

-Description<String>

Specifies a description for the email template.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-DisplayName<String>

Specifies the name of the email template.

エイリアス

なし

必須?

true

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Encoding<Encoding>

Specifies the encoding to be used in the message.

エイリアス

なし

必須?

false

位置は?

named

既定値

Unicode (UTF-8)

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Language<CultureInfo>

Specifies the language for the message.

エイリアス

なし

必須?

false

位置は?

named

既定値

English (United States)

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-ManagementPack<ManagementPack>

Specifies the name of the management pack in which the email template will be stored.

エイリアス

なし

必須?

false

位置は?

named

既定値

the default management pack

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-PassThru

Returns an object that represents the email template. This output object can be passed to other cmdlets.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-SCSession<Connection[]>

Specifies an object that represents the session to a Service Manager management server.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

true (ByValue)

ワイルドカード文字を許可する

false

-SendAsHtml

Specifies that this cmdlet causes the email to be sent as HTML.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Subject<String>

Provides the subject for the email message.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-TemplateCollection<Hashtable[]>

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.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Urgency<EmailTemplateUrgency>

Specifies the urgency of the email message. Valid values are:

-- High
-- Medium
-- Low

エイリアス

なし

必須?

false

位置は?

named

既定値

Medium

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Confirm

コマンドレットを実行する前に、ユーザーに確認を求めます。

必須?

false

位置は?

named

既定値

false

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-WhatIf

コマンドレットを実行するとどのような結果になるかを表示します。コマンドレットは実行されません。

必須?

false

位置は?

named

既定値

false

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

<CommonParameters>

このコマンドレットは次の共通パラメーターをサポートします。-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、-OutVariable.詳細については、以下を参照してください。 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216)。

入力

入力型は、コマンドレットにパイプできるオブジェクトの型です。

  • None.

    You cannot pipe input to this cmdlet.

出力

出力型は、コマンドレットによって生成されるオブジェクトの型です。

  • None.

    This cmdlet does not generate any output.

Example 1: Create an email template for a change to a printer

This script creates an email template that applies when a change occurs 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 "PS" ServiceManager.ConfigurationManagement.Configuration
PS C:\> $Language = [System.Globalization.CultureInfo]"EN"
PS C:\> $Encoding = [System.Text.Encoding]::ASCII
PS C:\> $EmailTemplateArgs = @{
>> Class = $PrinterClass
>> Subject = $Message
>> Body = $Message
>> ManagementPack = $ManagementPack
>> Language = $Language
>> Encoding = $Encoding
>> DisplayName = "Printer Email Template"
>> Description = "A template for printer notifications"
>> }
PS C:\> New-SCSMEmailTemplate @EmailTemplateArgs

Example 2: Create two templates that use different languages

This script creates two email templates, one in English and one in German. They are triggered when a change occurs to a computer that runs the Windows operating system.

PS C:\$Body1 = @'
>> A change has occurred to the following configuration item: 
>> $Context/Property[Type='System!System.Entity']/DisplayName$ 
>> which is owned by: 
>> $Context/Path[Relationship='System!System.ComputerPrimaryUser'   TypeConstraint='Windows!Microsoft.AD.UserBase']/Property[Type='Windows!Microsoft.AD.UserBase']/DistinguishedName$
>> Please investigate
>> Thank you
>> '@
PS C:\>$Body2 = @'
>>  Eine Konfigurationsänderung erfolgte in
>>  $Context/Property[Type='System!System.Entity']/DisplayName$ 
>>  der im Registrierungscontainer
>>  $Context/Path[Relationship='System!System.ComputerPrimaryUser' TypeConstraint='Windows!Microsoft.AD.UserBase']/Property[Type='Windows!Microsoft.AD.UserBase']/DistinguishedName$
>>  gespeichert ist.
>>  Prüfen Sie bitte nach.
>>  Vielen Dank 
>>  '@
PS C:\>$templates = @{
>>  Body = $Body1
>>  Subject = "This is a notification"
>>  Language = [globalization.cultureinfo]"en-us"
>>  },@{
>>  Body = $Body2
>>  Subject = "Benachrichtigungs-Email"
>>  Language = [globalization.cultureinfo]"de-de"
>>  }
PS C:\> $TemplateArguments = @{
>>    DisplayName = “WindowsChangeEmailTemplate”
>>  Class = get-SCSMClass -Name Microsoft.Windows.Computer
>>  SendAsHtml = $false
>>  TemplateCollection = $templates
>> }
PS C:\> New-SCSMEmailTemplate @TemplateArguments

関連トピック

Get-SCSMClass

Get-SCSMEmailTemplate

Get-SCSMManagementPack

Get-SCSMEmailTemplateContent

Remove-SCSMEmailTemplate

Update-SCSMEmailTemplate