New-SCSMEmailTemplate
New-SCSMEmailTemplate
Creates an email template for Service Manager.
Sintaxis
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>]
Descripción detallada
The New-SCSMEmailTemplate cmdlet creates an email template for Service Manager.
Parámetros
-Body<String>
Specifies the message body, which can include insertion strings.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-Class<ManagementPackClass>
Specifies the name of the class that the email template targets.
Alias |
ninguno |
¿Requerido? |
true |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
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.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
localhost |
¿Aceptar canalización? |
true (ByValue) |
¿Aceptar caracteres comodín? |
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.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
true (ByValue) |
¿Aceptar caracteres comodín? |
false |
-Description<String>
Specifies a description for the email template.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-DisplayName<String>
Specifies the name of the email template.
Alias |
ninguno |
¿Requerido? |
true |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-Encoding<Encoding>
Specifies the encoding to be used in the message.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
Unicode (UTF-8) |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-Language<CultureInfo>
Specifies the language for the message.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
English (United States) |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-ManagementPack<ManagementPack>
Specifies the name of the management pack in which the email template will be stored.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
the default management pack |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-PassThru
Returns an object that represents the email template. This output object can be passed to other cmdlets.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-SCSession<Connection[]>
Specifies an object that represents the session to a Service Manager management server.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
true (ByValue) |
¿Aceptar caracteres comodín? |
false |
-SendAsHtml
Specifies that this cmdlet causes the email to be sent as HTML.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-Subject<String>
Provides the subject for the email message.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
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.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-Urgency<EmailTemplateUrgency>
Specifies the urgency of the email message. Valid values are:
-- High
-- Medium
-- Low
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
Medium |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-Confirm
Solicita confirmación antes de ejecutar el cmdlet.
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
falso |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-WhatIf
Muestra lo que sucedería si se ejecutara el cmdlet. El cmdlet no se ejecuta.
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
falso |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
<CommonParameters>
Este cmdlet admite los siguientes parámetros comunes: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer y -OutVariable. Para obtener más información, consulte about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Entradas
El tipo de entrada es el tipo de los objetos que se pueden canalizar al cmdlet.
None.
You cannot pipe input to this cmdlet.
Salidas
El tipo de resultado es el tipo de objetos que emite el cmdlet.
None.
This cmdlet does not generate any output.
Ejemplos
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