使用命令行界面

 

上一次修改主题: 2006-04-10

note注意:
强烈建议您首先对当前服务器配置运行配置向导,以便可以导出有效的配置文件。

本节介绍配置向导的命令行版本。命令行界面使高级管理员可以更多地控制对 Exchange 管理包的配置。可执行文件的名称是 ExchangeMPConfig.exe。

该命令行界面主要支持两个操作:导入用户创建的配置文件,或以配置文件的形式创建报告,显示服务器或管理组的当前配置。

导入配置文件时,命令行界面支持无提示操作和交互式操作。对于无提示操作,除了命令行参数之外,不需要输入任何信息。此模式对于脚本很有用。若要在无提示模式下运行,除了指定配置文件之外,还必须以命令行参数的形式指定邮件访问帐户的用户名和密码。只有以前已创建的邮箱访问帐户,才能使用无提示模式。

在交互模式下,至少必须指定要导入的配置文件。可以选择在命令行上指定邮箱访问帐户。如果未输入该帐户,ExchangeMPConfig.exe 工具将提示您以交互方式输入该帐户。还将提示您输入邮箱访问帐户的密码。如果将通过工具创建邮箱访问帐户,则还必须要指定其 Exchange 邮箱的位置(Exchange 服务器、存储组和邮箱存储)。

命令行界面(如向导)可以在任何符合先决条件的工作站或服务器上运行。

ExchangeMPConfig.exe 语法

可以使用 ExchangeMPConfig.exe 工具导入和导出配置。

若要导入并应用配置,请使用以下命令行命令:

ExchangeMPConfig.exe /i <filename> [/u <domain\username> [/p <password>]]

/i filename.xml – 基于 filename.xml 中的信息设置用户服务器的配置。

可与 /i 一起使用的可选参数包括:

/u username – 用户可以使用 /u 参数指定邮箱存储帐户。用户名将采用“域\用户名”的格式。工具将验证这一点。

/p password – 用户可以使用 /p 参数指定“邮箱访问”帐户的密码。/u 是必需的参数。

若要导出配置,请使用以下命令行命令:

ExchangeMPConfig.exe /e <filename> [/s <serverFilter>] [/a <administrativeGroupFilter>]

/e filename.xml – 创建一个名为 filename.xml 的报告,其中包含选定服务器的配置信息。filename.xml 是与 /i 参数一起使用的配置文件 (configuration.xml)。

与 /e 一起使用的可选参数包括:

/s servername – 指定从其中获取配置文件的服务器(不是从默认本地计算机获取)。此参数可以与 * 和 ? 等通配符组合使用。有关详细信息,请参阅该工具的用法输出。

/a admin group – 指定从其获取配置的管理组的公用名。如果设置此参数,工具将发现指定域中的所有 Exchange 服务器,并从每台服务器获取配置信息,然后将信息保存到配置文件。此参数可以与 * 和 ? 等通配符组合使用。

/? – 显示命令的有效命令开关并提供每个命令的用途摘要。

每个参数和与参数关联的值之间必须用空格分隔。例如,/e configuration.xml 有效,但是 /e:configuration.xml、/e=configuration.xml 和 /econfiguration.xml 不是有效参数。

下表列出可以用于运行 ExchangeMPConfig.exe 的典型命令行。

命令行 描述

ExchangeMPConfig.exe

此命令在用户界面模式下运行向导。

ExchangeMPConfig.exe /i configuration.xml

此命令导入 configuration.xml 中指定的配置。如果本地计算机未安装 Exchange 系统管理器工具,或当前用户没有执行所需配置的权限,则将生成错误。

因为在命令行上未指定任何“邮箱访问”帐户,所以,在执行命令时,如果配置要求,系统会提示您输入“邮箱访问”帐户的用户名和密码。

note注意:
密码字段不显示。键入密码中的字符时,命令提示符指针会保留在同一位置。

输出:

C:\> ExchangeMPConfig.exe /i configuration.xml

Mailbox Access Account Username (Domain\account): <name user entered>

Password:

Configuration Successful.

输出(失败,权限):

C:\> ExchangeMPConfig.exe /i configuration.xml

Error: You do not have permissions to perform this operation. Please see %temp%\ConfigurationLog.log for details.

输出(失败,未安装管理工具):

C:\> ExchangeMPConfig.exe /i configuration.xml

Error: The Exchange System Management tools are required to run this command. Please install them and try again. Please see %temp%\ConfigurationLog.log for details.

输出(失败,其他):

C:\> ExchangeMPConfig.exe /i configuration.xml

Error: An error has occurred. Please see %temp%\ConfigurationLog.log for information.

输出(失败,命令行参数无效):

C:\> ExchangeMPConfig.exe /iconfiguration.xml

Error: The command line you specified is invalid. The invalid parameter was /iconfiguration.xml. Please correct the error and try again.

ExchangeMPConfig.exe /i configuration.xml /u ExDom\MailAcct

此命令的功能与 ExchangeMPConfig.exe /i configuration.xml 相同,但是因为提供了用户名,所以系统不会提示您以交互方式输入“邮箱访问”帐户。但是,如果配置中需要,仍会提示您输入“邮箱访问”帐户密码。

输出:

C:\> ExchangeMPConfig.exe /i configuration.xml /u ExchDomain\MailAcct

Password:

ExchangeMPConfig.exe /i configuration.xml /u ExDom\MailAcct /p pass

此命令执行的操作与上一个命令相同,但是在命令行上提供了“邮箱访问”帐户密码。使用这些参数时,系统不会提示您交互式输入任何信息。

ExchangeMPConfig.exe /e report.xml

此命令生成一个配置文件,其中包含所有 Exchange 服务器的当前配置信息。文件格式符合 /i 参数要求的格式。

输出:

C:\> ExchangeMPConfig.exe /e report.xml

Generating configuration report for the local system. This operation may take several minutes.

输出(失败,权限):

C:\> ExchangeMPConfig.exe /e report.xml

Error: You do not have permissions to perform this operation. Please see %temp%\ConfigurationLog.log for details.

输出(失败,未安装监视包):

C:\> ExchangeMPConfig.exe /e report.xml

Error: The Exchange Monitoring Pack is not installed on the local system. Please install it and try again. Please see %temp%\ConfigurationLog.log for details.

输出(失败,其他):

C:\> ExchangeMPConfig.exe /e report.xml

Error: An error has occurred. Please see %temp%\ConfigurationLog.log for information.

输出(失败,命令行参数无效):

C:\> ExchangeMPConfig.exe /econfiguration.xml

Error: The command line you specified is invalid. The invalid parameter was /econfiguration.xml. Please correct the error and try again.

ExchangeMPConfig.exe /e report.xml /s exch1

此命令生成一个配置文件。使用 /s 参数指定系统,将检索该系统的配置,而不是检索本地系统的配置。列出的服务器名称可以是 Exchange 计算机的 NetBIOS 名称或 FQDN 名称。

除了上一个命令中列出的错误之外,还必须将 Exchange 系统管理工具安装在运行配置工具的系统上。如果工具未安装在本地系统上,将收到错误消息。此外,如果无法与指定服务器联系,也将收到错误消息。此处只列出与上述错误不同的错误。

输出:

C:\> ExchangeMPConfig.exe /e report.xml /s exch1

Generating configuration report for exch1. This operation may take several minutes.

输出(失败,未安装管理工具):

C:\> ExchangeMPConfig.exe /e report.xml /s exch1

Error: The Exchange System Management tools are required to run this command. Please install them and try again. Please see %temp%\ConfigurationLog.log for details.

输出(失败,服务器无法访问):

C:\> ExchangeMPConfig.exe /e report.xml /s exch1

Error: System exch1 does not exist or cannot be contacted. Please try again later. Please see %temp%\ConfigurationLog.log for details.

ExchangeMPConfig.exe /e report.xml /a ExAG1

此命令的功能与前两个命令类似。它为使用 /a 参数指定的域生成一个配置文件。在所有运行 Exchange 和 Exchange 管理包的服务器上查询其当前配置。管理组名称必须是管理组的公用名。

输出:

C:\> ExchangeMPConfig.exe /e report.xml /a ExAG1

Generating configuration report for ExAG1. This operation may take several minutes.

输出(失败,服务器无法访问):

C:\> ExchangeMPConfig.exe /e report.xml /a ExAG1

Error: The Administrtive Group ExAG1 cannot be contacted. Please try again later. Please see %temp%\ConfigurationLog.log for details.

输出(失败,Exchange 5.5 管理组):

C:\> ExchangeMPConfig.exe /e report.xml /a ExAG1

Error: The Administrtive Group ExAG1 is an administrative group for a version of exchange not supported by this tool. This tool only supports Exchange 2000 and later administrative groups.

输出(失败,其他):

C:\> ExchangeMPConfig.exe /e report.xml /a ExAG1

Error: An error has occurred. Please see %temp%\ConfigurationLog.log for information.

ExchangeMPConfig.exe /?

此命令显示可执行文件的用法信息。如果用户未输入有效的命令行参数,也会显示用法信息。