New-MailUser (RTM)

 

適用版本: Exchange Server 2007

上次修改主題的時間: 2007-06-05

使用 New-MailUser 指令程式可建立新的擁有郵件功能的使用者。

語法

New-MailUser -Name <String> -ExternalEmailAddress <ProxyAddress> -OrganizationalUnit <OrganizationalUnitIdParameter> -Password <SecureString> -UserPrincipalName <String> [-Alias <String>] [-DisplayName <String>] [-DomainController <Fqdn>] [-FirstName <String>] [-Initials <String>] [-LastName <String>] [-MacAttachmentFormat <BinHex | UuEncode | AppleSingle | AppleDouble>] [-MessageBodyFormat <Text | Html | TextAndHtml>] [-MessageFormat <Text | Mime>] [-ResetPasswordOnNextLogon <$true | $false>] [-SamAccountName <String>] [-TemplateInstance <PSObject>] [-UsePreferMessageFormat <$true | $false>]

詳細描述

New-MailUser 指令程式會在 Active Directory 目錄服務中建立新的擁有郵件功能的使用者物件。

若要執行 New-MailUser 指令程式,必須對您使用的帳戶委派下列項目:

  • Exchange 收件者系統管理員角色
  • 適當 Active Directory 容器的帳戶操作員角色

如需管理 Microsoft Exchange Server 2007 所需之權限、委派角色及權利的相關資訊,請參閱權限考量

note附註:
並非所有使用者屬性都可以使用 New-MailUser 指令程式設定。您可以利用 Set-User 指令程式來進行其他設定。

參數

參數 必要 類型 描述

ExternalEmailAddress

必要

Microsoft.Exchange.Data.ProxyAddress

ExternalEmailAddress 參數會指定組織外部的電子郵件地址。會將傳送至擁有郵件功能之使用者的電子郵件,傳送到此外部地址。

Name

必要

System.String

Name 參數可指定擁有郵件功能之使用者的一般名稱 (CN)。

OrganizationalUnit

必要

Microsoft.Exchange.Configuration.Tasks.OrganizationalUnitIdParameter

OrganizationalUnit 參數可指定新增使用者的組織單位 (例如,redmond.contoso.com/contacts)。

Password

必要

System.Security.SecureString

Password 參數可指定郵件使用者用來保護其帳戶的密碼。

UserPrincipalName

必要

System.String

UserPrincipalName 參數會使用電子郵件地址格式 (例如 ted@contoso.com) 定義系統使用者的名稱。

Alias

選用

System.String

Alias 參數會指定使用者的別名。別名可包含字母、數字和下列標點符號和符號:

  • !
  • #
  • $
  • %
  • ^
  • &
  • *
  • +
  • -
  • .
  • /
  • =
  • ?
  • _
  • {
  • }
  • |
  • ~

DisplayName

選用

System.String

DisplayName 參數可指定郵件使用者能看到的名稱 (顯示在 Microsoft Outlook 中)。

DomainController

選用

Microsoft.Exchange.Data.Fqdn

若要指定將此組態變更寫入至 Active Directory 之網域控制站的網域全名 (FQDN),請在命令中加入 DomainController 參數。

FirstName

選用

System.String

FirstName 參數可指定郵件使用者的名字。

Initials

選用

System.String

Initials 參數可指定郵件使用者的縮寫。

LastName

選用

System.String

LastName 參數可指定郵件使用者的姓氏。

MacAttachmentFormat

選用

Microsoft.Exchange.Data.Directory.Recipient.MacAttachmentFormat

MacAttachmentFormat 參數為傳送給此郵件使用者的郵件指定 Apple Macintosh 作業系統附件格式。此參數的有效值為:

  • BinHex
  • UUENCODE
  • AppleSingle
  • AppleDouble

此參數預設是設為 BinHex。MacAttachmentFormat 參數的可接受值視 MessageFormat 參數而定。如果 MessageFormat 參數設為 Text,您只能對此參數使用 BinHex 或 UUENCODE 值。如果 MessageFormat 參數設為 MIME,您只能對此參數使用 BinHex、AppleSingle 或 AppleDouble 值。

MessageBodyFormat

選用

Microsoft.Exchange.Data.Directory.Recipient.MessageBodyFormat

MessageBodyFormat 參數為傳送給此郵件使用者的郵件指定郵件內文格式。此參數的有效值為:

  • Text
  • HTML
  • TextAndHtml

此參數預設是設為 TextAndHtml。

MessageFormatMessageBodyFormat 參數相互依賴。如果 MessageFormat 參數設為 MIME,則 MessageBodyFormat 參數可設為任何有效的值。然而,如果 MessageFormat 參數設為 Text,則 MessageBodyFormat 參數只可以設為 Text。因此,如果您想要將此參數設為 Html 或 TextAndHtml,您也必須將 MessageFormat 參數設為 MIME。

MessageFormat

選用

Microsoft.Exchange.Data.Directory.Recipient.MessageFormat

MessageFormat 參數為傳送給此郵件使用者的郵件指定郵件格式。

此參數的有效值為:

  • Text
  • MIME

此參數預設是設為 MIME。

MessageFormatMessageBodyFormat 參數相互依賴。如果 MessageFormat 參數設為 MIME,則 MessageBodyFormat 參數可設為任何有效值。然而,如果 MessageFormat 參數設為 Text,則 MessageBodyFormat 參數只可以設為 Text。因此,如果您想要將 MessageFormat 參數從 MIME 變更為 Text,您也必須將 MessageBodyFormat 參數變更為 Text。

ResetPasswordOnNextLogon

選用

System.Boolean

若將 ResetPasswordOnNextLogon 參數設為 $true,使用者必須在下次登入時變更密碼。

SamAccountName

選用

System.String

SamAccountName 參數定義用來支援執行舊版作業系統 (如 Microsoft Windows NT 4.0、Windows 98、Windows 95 及 LAN Manager) 之用戶端及伺服器的登入名稱。此屬性必須包含少於 20 個字元。帳戶名稱可包含字母、數字和下列標點符號和符號:

  • !
  • #
  • $
  • %
  • ^
  • &
  • -
  • .
  • _
  • {
  • }
  • |
  • ~

TemplateInstance

選用

System.Management.Automation.PSObject

TemplateInstance 參數提供現有的物件時,命令會使用該物件之組態,在本機或目標伺服器上建立該物件的實際複寫。

UsePreferMessageFormat

選用

System.Boolean

UsePreferMessageFormat 參數指定是否以信箱所設定的郵件格式設定,覆寫為網域所設定的全域設定。將此參數設為 $true,以信箱所設定的郵件格式設定覆寫任何全域設定。

輸入類型

傳回類型

錯誤

錯誤 描述

 

例外狀況

例外狀況 描述

 

範例

下列範例包含兩個命令。

在第一個命令中,會建立類型 System.Security.SecureString 的密碼 $password。執行命令後,會顯示 [輸入密碼] 提示。使用者輸入的字串會變成新密碼字串,$password

第二個命令會建立擁有郵件功能的新使用者物件 (名為 Ted Bremer),並藉由 Password 參數將新建的密碼指派給物件。Ted 是 Tailspin Toys 的員工,但因為必須與 Contoso 公司的員工密切合作,所以他在 contoso.com 中有一個電子郵件地址。Ted 在 Contoso 的 Exchange Server 上沒有信箱。傳送到 Ted 的 contoso.com 電子郵件地址的電子郵件,會傳送到其外部電子郵件地址 (ted@tailspintoys.com)。

$password = Read-Host "Enter password" -AsSecureString
New-MailUser -Name "Ted Bremer" -Password $password -ExternalEmailAddress ted@tailspintoys.com -UserPrincipalName ted@contoso.com -OrganizationalUnit contoso.com 

若要確保您目前閱讀的是最新資訊,並尋找其他的 Exchange Server 2007 說明文件,請造訪 Exchange Server 技術資源中心.