阅读:20
一、背景介绍
起因是TK推荐OneNote 2016 OCR。试图追加OneNote时触发了各种幺蛾子。
参[1],追加OneNote 2016的事后来解决了。但由此产生获取Office 2016离线安装包的念想。现在有Office 2019、2021,因故还是装Office 2016,本文所述内容对新版
本普适。
本文不包含激活,只包含下载、安装。
二、下载离线安装包
1) 下载”Office Deployment Tool”
参[3]
https://www.microsoft.com/en-us/download/details.aspx?id=49117
从此处下载ODT工具。ODT工具可以下载离线安装包,也可用于安装离线安装包。
假设下回来officedeploymenttool_14729-20228.exe,执行时相当于解压,假设解压到
X:\\Green\\ODT\\
其下有个setup.exe,这是ODT工具本身。可能还自带一些xml文件
configuration-Office2019Enterprise.xml
configuration-Office2021Enterprise.xml
configuration-Office365-x64.xml
configuration-Office365-x86.xml
可以理解成某些原始模板,不必管它们,可删除。
2) OfficeProPlus2016Volume_x86_download.xml
————————————————————————–
<Configuration>
<Add SourcePath=\”X:\\OfficeProPlus2016Volume\\x86\” OfficeClientEdition=\”32\”>
<Product ID=\”ProPlus2016Volume\”>
<Language ID=\”zh-cn\” />
<Language ID=\”en-us\” />
</Product>
</Add>
</Configuration>
————————————————————————–
SourcePath
提定保存离线安装包的目录
OfficeClientEdition
指定CPU位数
Product ID
参[4]
指定下截什么,比如ProPlus2019Volume、Excel2019Volume、OneNoteRetail等
Language ID
指定语言版本,可以只指定一种语言
————————————————————————–
官方说最新ODT不再支持ProPlus2016Volume,[4]中没有这个值,但实测可用。
更多配置项参[5]
2.1) 下载命令
cd /d X:\\Green\\ODT
setup.exe /download OfficeProPlus2016Volume_x86_download.xml
下载可以在普通cmd中进行,无需管理员级cmd。
2.1.1) 实际交由BITS下载
过去setup.exe是自己直接下载,在cmd中能看到下载所用URL列表。现在setup.exe委托给BITS下载,cmd中啥也看不到,只是阻塞,直至BITS下载结束。
BITS支持WinHTTP SOCKS5代理
netsh.exe winhttp show proxy
netsh.exe winhttp set proxy <ip:port> “<local>”
netsh.exe winhttp reset proxy
如果还想得到下载所用URL列表,或许可以拦截HTTPS请求,参看
《获取windbg离线安装包下载链接》
http://scz.617.cn:8/windows/202011161630.txt
无此必要,未实测。
2.1.2) 日志文件
参[5]
过去setup.exe自己下载并生成日志,可以在xml中指定日志文件存放在何处
————————————————————————–
<Configuration>
<Add SourcePath=\”X:\\OfficeProPlus2016Volume\\x86\” OfficeClientEdition=\”32\”>
<Product ID=\”ProPlus2016Volume\”>
<Language ID=\”en-us\” />
</Product>
</Add>
<Logging Level=\”Standard\” Name=\”OfficeProPlus2016Volume_x86_download.log\” Path=\”X:\\log\” />
</Configuration>
————————————————————————–
现在由BITS下载,上述配置无效。据说%temp%中有日志文件可供排错,应该是BITS的日志。
2.2) 下载结果
cd /d X:\\OfficeProPlus2016Volume\\x86
tree /F /A
\\—Office // 3.4G
\\—Data
| v32.cab
| v32_16.0.14931.20120.cab
|
\\—16.0.14931.20120 // 当前最新补丁号,随时间而不同
i320.cab // 24.4M
i320.cab.cat
i321033.cab
i322052.cab
i640.cab // 30.1M
i640.cab.cat
i641033.cab
i642052.cab
s320.cab
s321033.cab
s322052.cab
stream.x86.en-us.dat // 592M
stream.x86.en-us.dat.cat
stream.x86.x-none.dat // 2.26G
stream.x86.x-none.dat.cat
stream.x86.zh-cn.dat // 515M
stream.x86.zh-cn.dat.cat
若只下中文版OneNoteRetail,会小一些。
2.3) 指定小版本
参[3]
————————————————————————–
<Configuration>
<Add SourcePath=\”X:\\OfficeProPlus2016Volume\\x86\” OfficeClientEdition=\”32\” Version=\”16.0.14931.20120\”>
<Product ID=\”ProPlus2016Volume\”>
<Language ID=\”zh-cn\” />
</Product>
</Add>
</Configuration>
————————————————————————–
Version可以是数字,可以是”MatchInstalled”。若不指定Version,将下载当前最新版本。
3) OfficeProPlus2016Volume_x64_download.xml
————————————————————————–
<Configuration>
<Add SourcePath=\”X:\\OfficeProPlus2016Volume\\x64\” OfficeClientEdition=\”64\”>
<Product ID=\”ProPlus2016Volume\”>
<Language ID=\”zh-cn\” />
<Language ID=\”en-us\” />
</Product>
</Add>
</Configuration>
————————————————————————–
3.1) 下载命令
cd /d X:\\Green\\ODT
setup.exe /download OfficeProPlus2016Volume_x64_download.xml
3.2) 下载结果
cd /d X:\\OfficeProPlus2016Volume\\x64
tree /F /A
\\—Office // 3.66G
\\—Data
| v64.cab
| v64_16.0.14931.20120.cab
|
\\—16.0.14931.20120 // 当前最新补丁号,随时间而不同
i640.cab // 30.1M
i640.cab.cat
i641033.cab
i642052.cab
s640.cab
s641033.cab
s642052.cab
stream.x64.en-us.dat // 585M
stream.x64.en-us.dat.cat
stream.x64.x-none.dat // 2.54G
stream.x64.x-none.dat.cat
stream.x64.zh-cn.dat // 515M
stream.x64.zh-cn.dat.cat
三、 安装离线安装包
1) OfficeProPlus2016Volume_x86_install.xml
————————————————————————–
<Configuration>
<Add SourcePath=\”X:\\OfficeProPlus2016Volume\\x86\” OfficeClientEdition=\”32\”>
<Product ID=\”OneNoteRetail\”>
<Language ID=\”en-us\” />
</Product>
<Product ID=\”ExcelRetail\”>
<Language ID=\”en-us\” />
</Product>
<Product ID=\”PowerPointRetail\”>
<Language ID=\”en-us\” />
</Product>
<Product ID=\”WordRetail\”>
<Language ID=\”en-us\” />
</Product>
</Add>
<Updates Enabled=\”FALSE\” UpdatePath=\”X:\\OfficeProPlus2016Volume\\x86\” />
<Display Level=\”Full\” AcceptEULA=\”TRUE\” />
</Configuration>
————————————————————————–
意思是离线安装32位OneNote、Excel、PowerPoint、Word,可以根据实际需要定制。
禁止更新是为了断网状态下也能安装。微软示例中UpdatePath与SourcePath不同,我没有实测过UpdatePath,若不确定,删掉UpdatePath无妨,安装结束后在线更新也来
得及。
1.0) 错误的xml
————————————————————————–
<Configuration>
<Add SourcePath=\”X:\\OfficeProPlus2016Volume\\x86\” OfficeClientEdition=\”32\”>
<Product ID=\”ProPlus2016Volume\”>
<Language ID=\”en-us\” />
</Product>
</Add>
<Updates Enabled=\”FALSE\” UpdatePath=\”X:\\OfficeProPlus2016Volume\\x86\” />
<Display Level=\”Full\” AcceptEULA=\”TRUE\” />
</Configuration>
————————————————————————–
对断网安装而言这个xml有问题,”Product ID”不能指定成”ProPlus2016Volume”,安装报错
————————————————————————–
Invalid product ProPlus2016Volume specified.
Error configuring products!
————————————————————————–
不过也正常,参[4],官方说最新ODT不再支持ProPlus2016Volume,[4]中没有这个值。
目前该值可以用于下载,但无法用于安装。变通办法就是
OfficeProPlus2016Volume_x86_install.xml所示,单独安装各个模块。我猜ProPlus2016Volume、ProPlus2021Volume无此问题。
1.1) 安装命令
cd /d X:\\Green\\ODT
setup.exe /configure OfficeProPlus2016Volume_x86_install.xml
该命令无需所在主机联网,可以断网离线安装。
1.1.1) 确保管理员级cmd可以访问SourcePath
安装可以在普通cmd中进行,无需管理员级cmd,但有个微妙之处。setup.exe并不是真正负责安装的进程,就像下载会委托给BITS服务一样,安装也会委托给其他进程,
可能是下列两个中的某个,也可能是其他进程,未深究。
C:\\Program Files\\Common Files\\Microsoft Shared\\ClickToRun\\OfficeC2RClient.exe
C:\\Program Files\\Common Files\\Microsoft Shared\\ClickToRun\\OfficeClickToRun.exe
必须确保真正负责安装的进程能访问xml中指定的SourcePath,为此实际上要求管理员级cmd可以访问SourcePath。
当SourcePath在本机时这不是问题。考虑在Guest中安装,SourcePath位于Host中,用了”net use X: \\\\vmware-host\\Shared Folders”。这种情况下,管理员级cmd缺省很可能看不到X盘符,需要在管理员级cmd中显式手工”net use”映射之,然后可以在普通cmd中安装。
假设管理员级cmd无法访问xml中指定的SourcePath,安装时有个很容易误解的报错
————————————————————————–
Couldn\’t install
We\’re sorry, we can\’t continue because we weren\’t able to download a
required file. Please make sure you\’re connected to the internet or
connect to a different network, then try again.
Go online for additional help.
Error Code: 30182-2016 (3)
————————————————————————–
该报错实际是SourcePath不可达导致的。解决办法有二,要么在管理员级cmd中显式”net use”,要么修改xml,将
SourcePath=”X:\\OfficeProPlus2016Volume\\x86″
改成
SourcePath=”\\\\vmware-host\\Shared Folders\\OfficeProPlus2016Volume\\x86″
1.2) 不安装指定模块
参[5]
https://config.office.com
在此无需登录即可定制生成xml文件,比如
————————————————————————–
<Configuration>
<Add SourcePath=\”X:\\OfficeProPlus2019Volume\\x64\” OfficeClientEdition=\”64\”>
<Product ID=\”ProPlus2019Volume\”>
<Language ID=\”zh-cn\” />
<ExcludeApp ID=\”Access\” />
<ExcludeApp ID=\”Excel\” />
<ExcludeApp ID=\”Groove\” />
<ExcludeApp ID=\”Lync\” />
<ExcludeApp ID=\”OneDrive\” />
<ExcludeApp ID=\”Outlook\” />
<ExcludeApp ID=\”PowerPoint\” />
<ExcludeApp ID=\”Publisher\” />
<ExcludeApp ID=\”Word\” />
</Product>
</Add>
<Updates Enabled=\”TRUE\” UpdatePath=\”X:\\OfficeProPlus2019Volume\\x64\” />
<Display Level=\”Full\” AcceptEULA=\”TRUE\” />
</Configuration>
————————————————————————–
意思是安装Office 2019时不安装指定模块,估计只剩下OneNote。
定制生成的xml文件都比较复杂,一般没必要用定制网站。
这个xml与前一个xml不同。这个xml安装结束时在”Programs and Features”中只有一个Office项。前一个xml安装结束时,OneNote、Excel、PowerPoint、Word都是单独项,可以分别卸载,互不影响。
————————————————————————–
Control Panel
All Control Panel Items
Programs and Features
————————————————————————–
1.3) 指定升级策略
参[5]
————————————————————————–
<Configuration>
<Add SourcePath=\”X:\\OfficeProPlus2019Volume\\x64\” OfficeClientEdition=\”64\” Channel=\”Current\”>
<Product ID=\”ProPlus2019Volume\”>
<Language ID=\”zh-cn\” />
</Product>
</Add>
<Updates Enabled=\”TRUE\” UpdatePath=\”X:\\OfficeProPlus2019Volume\\x64\” />
<Display Level=\”Full\” AcceptEULA=\”TRUE\” />
</Configuration>
————————————————————————–
Channel缺省是Current,可取值有
BetaChannel
CurrentPreview
Current
MonthlyEnterprise
SemiAnnualPreview
SemiAnnual
2) OfficeProPlus2016Volume_x64_install.xml
————————————————————————–
<Configuration>
<Add SourcePath=\”X:\\OfficeProPlus2016Volume\\x64\” OfficeClientEdition=\”64\”>
<Product ID=\”OneNoteRetail\”>
<Language ID=\”en-us\” />
</Product>
<!–
<Product ID=\”ExcelRetail\”>
<Language ID=\”en-us\” />
</Product>
<Product ID=\”PowerPointRetail\”>
<Language ID=\”en-us\” />
</Product>
<Product ID=\”WordRetail\”>
<Language ID=\”en-us\” />
</Product>
–>
</Add>
<Updates Enabled=\”FALSE\” UpdatePath=\”X:\\OfficeProPlus2016Volume\\x64\” />
<Display Level=\”Full\” AcceptEULA=\”TRUE\” />
</Configuration>
————————————————————————–
意思是离线安装64位OneNote,可以根据实际需要定制。
禁止更新是为了断网状态下也能安装。
2.1) 安装命令
cd /d X:\\Green\\ODT
setup.exe /configure OfficeProPlus2016Volume_x64_install.xml
该命令无需所在主机联网,可以断网离线安装。
2.2) 检查64位激活状态
cd /d “%ProgramFiles%\\Microsoft Office\\Office16”
cscript.exe //nologo ospp.vbs /dstatus
事实上之前的激活保持有效,无需额外处理。
参考资源
[1] Install or reinstall OneNote for Windows
https://support.microsoft.com/en-us/office/install-or-reinstall-onenote-for-windows-c08068d8-b517-4464-9ff2-132cb9c45c08
[3] Overview of the Office Deployment Tool
https://docs.microsoft.com/en-us/deployoffice/overview-office-deployment-tool
Release history for Office Deployment Tool
https://docs.microsoft.com/en-us/officeupdates/odt-release-history
Office Deployment Tool
https://www.microsoft.com/en-us/download/details.aspx?id=49117
https://download.microsoft.com/download/2/7/A/27AF1BE6-DD20-4CB4-B154-EBAB8A7D4A7E/officedeploymenttool_14729-20228.exe
[4] List of Product IDs which are supported by the Office Deployment Tool for Click-to-Run
https://docs.microsoft.com/en-us/office365/troubleshoot/installation/product-ids-supported-office-deployment-click-to-run
[5] 创建新的配置
https://config.office.com
https://config.office.com/deploymentsettings
Overview of the Office Customization Tool
https://docs.microsoft.com/en-us/deployoffice/admincenter/overview-office-customization-tool
Configuration options for the Office Deployment Tool
https://docs.microsoft.com/en-us/deployoffice/office-deployment-tool-configuration-options
(详解xml配置项,包括通过xml卸载)
版权声明
本站“技术博客”所有内容的版权持有者为绿盟科技集团股份有限公司(“绿盟科技”)。作为分享技术资讯的平台,绿盟科技期待与广大用户互动交流,并欢迎在标明出处(绿盟科技-技术博客)及网址的情形下,全文转发。
上述情形之外的任何使用形式,均需提前向绿盟科技(010-68438880-5462)申请版权授权。如擅自使用,绿盟科技保留追责权利。同时,如因擅自使用博客内容引发法律纠纷,由使用者自行承担全部法律责任,与绿盟科技无关。
最新评论
Thanks for your blog, nice to read. Do not stop.
1
1
你图片显示不了
你的网站怎么注册啊