Office 部署工具概述Overview of the Office Deployment Tool

Office 部署工具 (ODT) 是一款命令行工具,可以使用它下载并将 Office 365 专业增强版部署到客户端计算机。ODT 使你可以更好地控制 Office 安装:可以定义要安装哪些产品和语言、应该如何更新这些产品以及是否向用户显示安装体验。The Office Deployment Tool (ODT) is a command-line tool that you can use to download and deploy Office 365 ProPlus to your client computers. The ODT gives you more control over an Office installation: you can define which products and languages are installed, how those products should be updated, and whether or not to display the install experience to your users.

如果你不是企业管理员,而且希望在家或企业中安装 Office 365,请参阅使用 Office 365 安装 OfficeIf you're not an enterprise administrator and are looking to install Office 365 in your home or business, see Install Office with Office 365.

下载 Office 部署工具Download the Office Deployment Tool

从 Microsoft 下载中心下载 Office 部署工具。Download the Office Deployment Tool from the Microsoft Download Center.

下载文件后,运行自解压缩可执行文件,其中包含 Office 部署工具可执行文件 (setup.exe) 和一个示例配置文件 (configuration.xml)。After downloading the file, run the self-extracting executable file, which contains the Office Deployment Tool executable (setup.exe) and a sample configuration file (configuration.xml).

使用 ODT 下载或安装 Office 前,我们建议你确保使用了最新版本。Before using the ODT to download or install Office, we recommend making sure you have the latest version.

开始使用 Office 部署工具Get started with the Office Deployment Tool

ODT 包含 2 个文件:setup.exe 和 configuration.xml。若要使用该工具,请编辑配置文件以定义所需选项,然后从命令行运行 setup.exe。例如,可编辑配置文件以下载 64 位英文版的 Office,或编辑文件以安装 64 位 Office 英文版,同时自动接受 EULA 且不安装 Publisher。有关完整选项,请参阅 Office 部署工具的配置选项The ODT consists of two files: setup.exe and configuration.xml. To work with the tool, you edit the configuration file to define what options you want, and then run setup.exe from the command line. For example, you can edit the configuration file to download the 64-bit English edition of Office, or you can edit the file to install the 64-bit English edition of Office with the EULA automatically accepted and without Publisher. For the full set of options, see Configuration options for the Office Deployment Tool.

备注

最佳做法: 本文介绍了 Office 部署工具的配置文件中的 XML 元素和属性。Best practice: This article shows the XML elements and attributes in the configuration file for the Office Deployment Tool. 你可以继续在文本编辑器中创建配置文件,但我们建议使用“Office 自定义工具”。You can continue to create the configuration file in a text editor, but we recommend using the Office Customization Tool instead. 利用 Office 自定义工具,你可以在基于 Web 的界面中轻松创建和修改配置文件。With the Office Customization Tool, you can easily create and modify configuration files in a web-based interface. 有关更多详细信息,请参阅 Office 部署工具概述For more details, see Overview of the Office Customization Tool.

运行 ODT 时,需提供配置文件的位置,并定义应在何种 模式 下运行 ODT:When running the ODT, you provide the location of the configuration file and define which mode the ODT should run in:

  • 若要下载 Office 365 专业增强版产品和语言,请使用下载模式。示例:setup.exe /download downloadconfig.xml。请注意,在将 Office 下载到已包含相应版本 Office 的文件夹时,ODT 将通过仅下载缺失的文件来节省网络带宽。例如,如果使用 ODT 将 Office 英文版和德语版下载到已包含英文版 Office 的文件夹,将仅下载德语语言包。To download Office 365 ProPlus products and languages, use download mode. Example: setup.exe /download downloadconfig.xml. Note that when you download Office to a folder that already contains that version of Office, the ODT will conserve your network bandwidth by downloading only the missing files. For example, if you use the ODT to download Office in English and German to a folder that already contains Office in English, only the German language pack will be downloaded.

  • 若要在客户端计算机上安装已下载的 Office 365 专业增强订阅版 产品和语言,请使用 配置模式。也可使用配置模式来删除和更新 Office 产品和语言。示例: setup.exe /configure installconfig.xmlTo install the downloaded Office 365 ProPlus products and languages on a client computer, use configure mode. You also use configure mode to remove and update Office products and languages. Example: setup.exe /configure installconfig.xml

  • 若要将新应用程序设置应用于已安装 Office 365 专业增强版的客户端计算机,使用自定义模式。此模式将仅应用应用程序设置,而不更改其他任何部署设置。示例:setup.exe /customize appsettingsconfig.xmlTo apply new application settings to client computers that already have Office 365 ProPlus installed, use customize mode. This mode will apply only application settings, without changing any other deployment settings. Example: setup.exe /customize appsettingsconfig.xml

  • 若要从已下载的 Office 365 专业增强版产品和语言创建 App-V 包,请使用 包装模式。示例:setup.exe /packager packageconfig.xmlTo create an App-V package from the downloaded Office 365 ProPlus products and languages, use packager mode. Example: setup.exe /packager packageconfig.xml

也可以使用 帮助模式阅读有关工具的命令行帮助。You can also use help mode to read command-line help for the tool.

下载 Office 365 ProPlus 的安装文件Download the installation files for Office 365 ProPlus

请按照以下步骤从 Office 内容传递网络 (CDN) 下载 Office 365 ProPlus 的安装文件。Follow these steps to download installation files for Office 365 ProPlus from the Office Content Delivery Network (CDN).

步骤 1:创建配置文件Step 1: Create the configuration file

创建配置文件时,我们建议从示例文件开始,并为你的环境使用合适的选项以对其进行更新。可以首先将以下示例复制和粘贴到文本文件,使用你选择的名称将其保存,然后编辑 XML 元素和属性以定义所需的选项。When creating the configuration file, we recommend starting with an example file and updating it with the appropriate options for your environment. You can start by copying and pasting the example below into a text file, saving it with a name of your choosing, and then editing the XML elements and attributes to define the options you want.

在此示例中,配置文件将 32 位英语版 Office 365 专业增强版和 Visio Online Plan 2(以前名为 Visio Pro for Office 365)的安装文件下载到网络上的 \\server\share:In this example, the configuration file downloads the installation files for a 32 bit English edition of Office 365 ProPlus and Visio Online Plan 2 (previously named Visio Pro for Office 365) to \\server\share on your network:

<Configuration> 
  <Add SourcePath="\\server\share" OfficeClientEdition="32"> 
   <Product ID="O365ProPlusRetail" > 
     <Language ID="en-us" />      
   </Product> 
   <Product ID="VisioProRetail" > 
     <Language ID="en-us" />      
   </Product> 
 </Add> 
</Configuration>

若要详细了解配置选项和更多示例,请参阅 Office 部署工具的配置选项For more information about the configuration options and more examples, see Configuration options for the Office Deployment Tool.

步骤 2:在下载模式下运行 ODT 可执行文件Step 2: Run the ODT executable in download mode

在命令提示符处,在下载模式下使用对刚保存的配置文件的引用运行 ODT 可执行文件。在此示例中,配置文件名为 downloadconfig.xml:From a command prompt, run the ODT executable in download mode and with a reference to the configuration file you just saved. In this example, the configuration file is named downloadconfig.xml:

setup.exe /download downloadconfig.xml

步骤 3:验证是否已下载该文件Step 3: Validate that the files have been downloaded

运行命令后,转到在配置文件中定义的下载位置,并在此处查看具有合适的文件的 Office 文件夹。如果遇到问题,请确保你拥有 ODT 的最新版本。也可以通过查看 %temp% 目录中的日志文件来对该问题进行故障排除。After running the command, go to the download location you defined in the configuration file and look for an Office folder with the appropriate files in it. If you run into problems, make sure you have the newest version of the ODT. You can also troubleshoot issues by reviewing the log file in the %temp% directory.

从本地源下载 Office 365 ProPlus 的安装文件。Download the installation files for Office 365 ProPlus from a local source

Office 部署工具可用于从网络本地源下载 Office 365 专业增强版的安装文件,而不是从 Office 内容分发网络 (CDN) 下载。这样一来,可以存储 Office 多种语言和产品的中心副本,并只将所需语言和产品分发到网络上的其他位置。You can use the Office Deployment Tool to download the installation files for Office 365 ProPlus from a local source on your network instead of from the Office Content Delivery Network (CDN). By doing so, you can store a central copy of multiple languages and products for Office and distribute just the languages and products that you need to other locations on your network.

若要从本地源下载,请按照使用 ODT 下载 Office 的步骤操作,不同之处在于要在配置文件中添加下载路径,此路径定义了从哪里下载安装文件。例如,此配置文件将 32 位英语版 Office 365 专业增强版从 \\servera\share (DownloadPath) 下载到 \\serverb\share (SourcePath):To download from a local source, follow the steps for downloading Office with the ODT, but include in your configuration file the download path, which defines where the installation files are downloaded from. For example, this configuration file downloads a 32 bit English edition of Office 365 ProPlus from \\servera\share (the DownloadPath) to \\serverb\share (the SourcePath):

<Configuration> 
  <Add SourcePath="\\serverb\share" OfficeClientEdition="32" Version="16.0.6741.2056" DownloadPath="\\servera\share"> 
    <Product ID="O365ProPlusRetail" > 
      <Language ID="en-us" />      
    </Product> 
  </Add> 
</Configuration>

请注意,使用 DownloadPath 时,必须指定 VersionNote that you must specify a Version when using DownloadPath.

安装 Office 365 专业增强版Install Office 365 ProPlus

下载 Office 365 ProPlus 安装文件后,按照下面的步骤在客户端计算机上安装 Office。作为安装的一部分,你可以选择安装哪种产品。After you download Office 365 ProPlus installation files, follow these steps to install Office on a client computer. As part of that installation, you can choose which products to install.

步骤 1:创建配置文件Step 1: Create the configuration file

创建配置文件时,我们建议从示例文件开始,并为你的环境使用合适的选项以对其进行更新。可以通过将以下示例复制和粘贴到文本文件、使用你选择的名称将其保存,然后编辑 XML 元素和属性以定义你想要使用的选项开始。When creating the configuration file, we recommend starting with an example file and updating it with the appropriate options for your environment. You can start by copying and pasting the example below into a text file, saving it with a name of your choosing, and then editing the XML elements and attributes to define the options you want.

在此示例中,配置文件安装了不含 Publisher 的 32 位英语版 Office 365 专业增强版:In this example, the configuration file installs a 32 bit English edition of Office 365 ProPlus without Publisher:

<Configuration> 
  <Add SourcePath="\\Server\share" OfficeClientEdition="32">
    <Product ID="O365ProPlusRetail" > 
      <Language ID="en-us" />        
      <ExcludeApp ID="Publisher" />
    </Product> 
  </Add> 
  <Display Level="None" AcceptEULA="TRUE" />
</Configuration> 

Office 安装文件的位置是 \\server\share。显示级别设置为 None,即用户在安装期间不会看到任何用户界面;AcceptEULA 设置为 TRUE,即用户在安装期间无需单击接受 EULA。The location of the Office installation files is \\server\share. The display level is set to None, which means the user will not see any user interface during the install, and the AcceptEULA is set to TRUE, which means your users will not have to click to accept the EULA during the installation.

有关配置选项的详细信息,请参阅 Office 部署工具的配置选项For more information about the configuration options, see Configuration options for the Office Deployment Tool.

步骤 2:在配置模式下运行 ODT 可执行文件Step 2: Run the ODT executable in configure mode

在命令提示符处,在配置模式下使用对刚保存的配置文件的引用运行 ODT 可执行文件。在以下示例中,配置文件命名为 installconfig.xmlFrom a command prompt, run the ODT executable in configure mode with a reference to the configuration file you just saved. In the following example, the configuration file is named installconfig.xml:

setup.exe /configure installconfig.xml

必须在想要安装 Office 的客户端计算机上运行可执行文件,且必须具有该计算机的本地管理员权限。You must run the executable from the client computer on which you want to install Office and you must have local administrator permissions on that computer.

步骤 3:验证是否成功安装Step 3: Verify that installation was successful

运行命令后,应该会看到 Office 安装开始(除非将显示级别设置为 None)。安装完成后,命令提示符将显示“已成功配置产品”。如果遇到问题,请确保使用的是最新版 ODT。还可以检查 %temp% 和 %windir%\temp 目录中的日志文件来排查问题。After running the command, you should see the Office installation start (unless you set display level to none). After installation is complete, the command prompt will display "Products configured successfully." If you run into problems, make sure you have the newest version of the ODT. You can also troubleshoot issues by reviewing the log files in the %temp% and %windir%\temp directories.

Office 365 ProPlus 更新Update Office 365 ProPlus

安装 Office 365 专业增强版后,可以使用 Office 部署工具来更新客户端计算机。这样做的方法有两种:You can use the Office Deployment Tool to make updates to your client computers after installing Office 365 ProPlus. There are two ways to do this:

  • 适用 ODT 再次安装 Office 365 ProPlus(会将 Office 更新至最新版本)。新版本中只有已更改的文件才会被更新。Use the ODT to install Office 365 ProPlus again, which will update Office to the newest version. Only the files that have changed in the new version will be updated.

  • 使用 ODT 下载 Office 安装文件,然后将你的客户端计算机指向该位置以接收其更新。(默认情况下,客户端将直接从 Office 内容传递网络 (CDN) 更新。)Use the ODT to download the Office installation files and then point your client computers to that location to receive their updates. (By default, clients are updated directly from the Office Content Delivery Network (CDN).)

若要更改客户端计算机从哪里接收更新,请在配置模式下运行 ODT,并在配置文件中指定更新路径。例如,若要让 Office 365 专业增强版自动从 \\server\updates 网络共享获取更新,请在 configuration.xml 文件中添加下面的代码行:To change where your client computers receive their updates, run the ODT in configure mode and specify an update path in the configuration file. For example, to have Office 365 ProPlus get updates automatically from a network share called \\server\updates, include the following line in your configuration.xml file:

<Updates Enabled="TRUE" UpdatePath="\\server\updates" />

本文并未涵盖组织中与管理 Office 更新相关的所有问题。有关端到端方案的详细信息(包括使用组策略),请参阅选择如何管理 Office 365 专业增强版的更新程序This article does not cover all the issues related to managing updates for Office in your organization. For more information on that end-to-end scenario, including using Group Policy, see Choose how to manage updates to Office 365 ProPlus.

从客户端计算机中排除或删除 Office 365 专业增强版应用程序Exclude or remove Office 365 ProPlus products from client computers

安装 Office 365 专业增强版时,可以排除特定应用程序。为此,请按照“使用 ODT 安装 Office”中的步骤操作,不同之处在于要在配置文件中添加 ExcludeApp 元素。例如,下面的配置文件安装除 Publisher 以外的所有 Office 365 专业增强版应用程序:When installing Office 365 ProPlus, you can exclude specific products. To do so, follow the steps for installing Office with the ODT, but include the ExcludeApp element in your configuration file. For example, this configuration file installs all the Office 365 ProPlus products except Publisher:

<Add SourcePath="\\Server\share" Version="15.1.2.3" OfficeClientEdition="32">
    <Product ID="O365ProPlusRetail" >
      <Language ID="en-us" />
      <ExcludeApp ID="Publisher" />
    </Product>
</Add>

如果已安装 Office 365 专业增强版,也可以使用 ExcludeApp 元素删除以前安装的应用程序。例如,上面的配置文件从旧 Office 安装中删除 Publisher。If you've already installed Office 365 ProPlus, you can also use the ExcludeApp element to remove a product that you've previously installed. For example, the configuration file above removes Publisher from the previous installation of Office.

还可以删除 Office 365 专业增强订阅版 的整个语言版本。为此,请按照使用 ODT 安装 Office 的排除产品步骤操作,但请将配置文件替换为使用 Remove 元素的配置文件。例如,此配置文件删除 Office 365 专业增强订阅版的西班牙语版本:You can also remove an entire language version of Office 365 ProPlus. To do so, follow the steps for excluding products for installing Office with the ODT, but replace the configuration file with one that uses the Remove element. For example, this configuration file removes the Spanish language version of Office 365 ProPlus:

<Configuration> 
 <Remove>
    <Product ID="O365ProPlusRetail" > 
      <Language ID="es-es" />        
    </Product> 
 </Remove>
</Configuration> 

若要深入了解排除或删除应用的选项,请参阅 Office 部署工具的配置选项For more information about the options for excluding or removing apps, see Configuration options for the Office Deployment Tool.

安装 Office 365 专业增强版或其他应用程序时排除 OneDriveExclude OneDrive when installing Office 365 ProPlus or other applications

安装 Office 365 专业增强版、Word、Excel、PowerPoint、Publisher、Visio 和 Skype 时,将自动安装 OneDrive。如果不希望 OneDrive 随这些应用程序安装,使用 ExcludeApp 元素将其删除,如示例中所示。OneDrive is automatically installed when you install Office 365 ProPlus, Word, Excel, PowerPoint, Publisher, Visio, and Skype. If you don't want OneDrive installed with those applications, use the ExcludeApp element to remove it, as shown in the example.

<Add SourcePath="\\Server\share" Version="15.1.2.3" OfficeClientEdition="32">
    <Product ID="O365ProPlusRetail" >
      <Language ID="en-us" />
      <ExcludeApp ID="OneDrive" />
    </Product>
</Add>

部署多种语言或匹配的语言Deploy multiple or matching languages

有关部署语言的详细信息,请参阅在 Office 365 专业增强版中部署语言的概述For details on deploying languages, see Overview of deploying languages in Office 365 ProPlus.

将应用程序设置应用于 Office 365 专业增强版Apply application settings to Office 365 ProPlus

在部署过程中,可以定义 Office 365 专业增强版的应用程序设置,包括 VBA 宏通知、默认文件位置和默认文件格式。为此,请按照安装 Office 365 专业增强版中的标准步骤来部署 Office,不同之处在于将应用程序设置添加为配置文件的一部分。As part of your deployment, you can define application settings for Office 365 ProPlus, including VBA Macro notifications, default file locations, and default file formats. To do so, you deploy Office using the standard steps in Install Office 365 ProPlus, but you include application settings as part of your configuration file.

若要创建配置文件,建议使用即点即用 Office 自定义工具,这是一款具有完整用户界面的 Web 应用程序。To create the configuration file, we recommend you use the Office Customization Tool for Click-to-Run, a web application with a full user interface.

  1. 在 Web 浏览器中打开即点即用 Office 自定义工具并按步骤创建配置文件,包括定义标准部署设置旁边的应用程序设置。In your web browser, open the Office Customization Tool for Click-to-Run and follow the steps to create a configuration file, including defining application settings alongside the standard deployment settings.
  2. 导出文件。Export the file.
  3. 按照安装 Office 365 专业增强版中的步骤操作,为 Office 部署新创建的配置文件。Follow the steps in Install Office 365 ProPlus to deploy Office with the newly created configuration file.

在此示例中,配置文件安装了 32 位英语版 Office 365 专业增强版,并在 Excel 中显示所有 VBA 宏的信任栏。In this example, the configuration file installs the 32-bit version of Office 365 ProPlus in English and displays the Trust Bar for all VBA macros in Excel.

<Configuration>
  <Add OfficeClientEdition="32" Channel="Broad">
    <Product ID="O365ProPlusRetail">
      <Language ID="en-us" />
    </Product>
  </Add>
  <AppSettings>
    <User Key="software\microsoft\office\16.0\excel\security"
          Name="vbawarnings" 
          Value="3" 
          Type="REG_DWORD" 
          App="excel16" 
          Id="L_VBAWarningsPolicy" />
  </AppSettings>
</Configuration>

此文件是使用即点即用 Office 自定义工具创建的。This file was created with the Office Customization Tool for Click-to-Run. 有关应用设置的更多详细信息,建议你浏览工具本身的选项。For more details on the app settings, we recommend browsing the options in the tool itself.

注意:安装 Office 后,会将在配置文件中定义的应用设置应用于设备的所有现有用户以及未来添加到该设备的任何新用户。Note: When Office is installed, the app settings defined in the configuration file are applied to all existing users of the device and any new users added to the device in the future.

将应用程序设置应用于已安装的 Office 365 专业增强版Apply application settings to an existing installation of Office 365 ProPlus

可以将新应用程序设置应用到已安装 Office 365 专业增强版的客户端计算机,而不更改任何其他部署设置。为此,要创建包含应用程序设置的配置文件,然后在自定义模式下运行 ODT。自定义模式将忽略配置文件中除应用程序设置外的所有其他设置。You can apply new application settings to client computers that already have Office 365 ProPlus installed without changing any other deployment setting. To do so, create a configuration file that contains application settings and then run the ODT in customize mode. Customize mode ignores all other settings in the configuration file except application settings.

  1. 使用定义应用程序首选项中的步骤来创建配置文件。Use the steps in define application preferences to create the configuration file.
  2. 在命令提示符处,在自定义模式下运行 ODT 可执行文件(引用刚创建的配置文件)。在下面的示例中,配置文件名为 installappsettings.xmlFrom a command prompt, run the ODT executable in customize mode with a reference to the configuration file you just created. In the following example, the configuration file is named installappsettings.xml:

setup.exe /customize installappsettings.xml

必须在想要应用应用设置的客户端计算机上运行可执行文件,且必须具有该计算机的本地管理员权限。You must run the executable from the client computer on which you want to apply the app settings and you must have local administrator permissions on that computer. 注意:在使用自定义模式时,会将在配置文件中定义的应用设置应用于设备的所有现有用户以及未来添加到该设备的任何新用户。Note that when using customize mode, the app settings defined in the configuration file are applied to all existing users of the device and any new users added to the device in the future. 如果在 Office 应用运行时实施应用程序设置,则将在 Office 下次重启时应用这些设置。If you apply application settings when Office apps are running, the settings will be applied when Office is next restarted.

为 Office 365 专业增强版创建 APP-V 包Create an App-V package for Office 365 ProPlus

除了下载和部署 Office 365 专业增强版,还可以使用 Office 部署工具创建 App-V 包。为此,请更新配置文件,然后在包装模式下运行 ODT。必须在全新安装操作系统的计算机上创建 App-V 包。In addition to downloading and deploying Office 365 ProPlus, you can use the Office Deployment Tool to create App-V packages. To do so, update the configuration file and then run the ODT in packager mode. You must create App-V packages on a computer with a clean install of the operating system.

本文并未涵盖与部署 App-V 包相关的所有问题。有关端到端方案的详细信息,请参阅使用 App-V 部署 Microsoft Office 2016This article does not cover all the issues related to deploying App-V packages. For more information on that end-to-end scenario, see Deploying Microsoft Office 2016 by Using App-V.

步骤 1:创建配置文件Step 1: Create the configuration file

创建配置文件时,我们建议从示例文件开始,并为你的环境使用合适的选项以对其进行更新。可以通过将以下示例复制和粘贴到文本文件、使用你选择的名称将其保存,然后编辑 XML 元素和属性以定义你想要使用的选项开始。When creating the configuration file, we recommend starting with an example file and updating it with the appropriate options for your environment. You can start by copying and pasting the example below into a text file, saving it with a name of your choosing, and then editing the XML elements and attributes to define the options you want.

在此示例中,配置文件通过不含 Publisher 的 32 位英语版 Office 365 专业增强版创建 App-V 包:In this example, the configuration file creates an App-V package from a 32-bit English edition of Office 365 ProPlus without Publisher:

<Configuration> 
 <Add SourcePath="\\Server\share" OfficeClientEdition="32">
    <Product ID="O365ProPlusRetail" > 
      <Language ID="en-us" />        
      <ExcludeApp ID="Publisher" />
    </Product> 
 </Add> 
</Configuration> 

Office 安装文件的位置是 \\server\share。对于配置文件,请将示例值替换为环境对应的选项。若要详细了解选项,请参阅 Office 部署工具的配置选项The location of the Office installation files is \\server\share. For your configuration file, substitute the example values with the appropriate option for your environment. For more information about the options, see Configuration options for the Office Deployment Tool,

步骤 2:在包装模式下运行 ODT 可执行文件Step 2: Run the ODT executable in packager mode

通过命令提示符,在包装模式下运行 ODT 可执行文件,同时引用刚保存的配置文件和所需的 App-V 包保存位置。在下面的示例中,配置文件名为 packageconfig.xml,App-V 包将被保存至 \\server\share\appv\From a command prompt, run the ODT executable in packager mode with a reference to the configuration file you just saved and to the location where you want to save the App-V package. In the following example, the configuration file is named packageconfig.xml and the App-V package will be saved to \\server\share\appv\:

setup.exe /packager packageconfig.xml \\server\share\appv\

步骤 3:验证是否已创建包Step 3: Verify that the package was created

运行命令后,程序包位置应当有 App-V 包文件夹和 WorkingDir 文件夹。可以通过查看 %temp% 目录中的日志文件来对该问题进行故障排除。After running the command, the package location should have an App-V Packages folder and a WorkingDir folder. You can troubleshoot issues by reviewing the log file in the %temp% directory.