链接 Visual Basic 脚本以在 CacheOnly 安装过程中复制 Config.xml
更新时间: 2007年3月
应用到: Office Resource Kit
上一次修改主题: 2007-03-22
管理员可以在 CacheOnly 安装过程中将自定义的 Config.xml 文件复制到 Msocache 子文件夹,从而使用缓存安装程序文件自动执行 2007 Microsoft Office system 自定义副本的安装过程。
管理员可以在 CacheOnly 安装中链接 Visual Basic 脚本以创建包含自定义 Config.xml 文件副本的本地安装源 (LIS)。从 LIS 中运行安装程序时,自定义 Config.xml 文件可用。
本主题包括一个 Visual Basic 脚本(名为 copy_configxml.vbs)的示例,并提供有关使用此脚本的说明。
示例
借助 Visual Basic 脚本(如下面示例中的脚本 (copy_configxml.vbs))和 CacheOnly Config.xml 设置文件,您可以通过运行 LIS 文件位置中的 Setup.exe 来 Office 2007,而不必指定自定义 Config.xml 文件。系统会自动使用自定义 Config.xml 文件,因为该文件与 Setup.exe 文件位于同一位置。
dim FileSys, CustConfigXml, WshShell
'*** Use this constant to specify the patch and file name of the custom settings file.
Const PathCustConfigXml = \\server\share\config.xml
'*** Use this constant to specify the GUID of the Office product being installed.
'*** Office 2007 Enterprise (Enterprise) GUID = {90120000-0030-0000-0000-0000000FF1CE}
'*** Office 2007 Professional (Enterprise) GUID = {90120000-0014-0000-0000-0000000FF1CE}
'*** Office 2007 Professional Plus (Enterprise) GUID = {90120000-0011-0000-0000-0000000FF1CE}
'*** Office 2007 Small Business (Enterprise) GUID = {90120000-00CA-0000-0000-0000000FF1CE}
'*** Office 2007 Standard (Enterprise) GUID = {90120000-0012-0000-0000-0000000FF1CE}
'*** See KB article 928516, "Description of numbering scheme for product code GUIDs in Office 2007" for additional information.
Const Guid = "{90120000-0011-0000-0000-0000000FF1CE}"
set FileSys = CreateObject ("Scripting.FileSystemObject")
set WshShell = WScript.CreateObject("WScript.Shell")
'*** Specify the path and filename of the shared settings file that is to be copied.
set CustConfigXml = filesys.GetFile(PathCustConfigXml)
'*** Determine the product specific location that the settings file should be copied to. The GUID will vary by product.
MSOCacheFldr = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & Guid & "\InstallSource")
'*** Copy the shared settings file to the appropriate MSOCache subfolder.
CustConfigXml.copy MSOCacheFldr
有关 Office 2007 中产品代码 GUID 的编号方案的信息,请参阅 Microsoft 帮助和支持网站上的知识库文章 928516:2007 Office 套件和程序中产品代码 GUID 的编号方案说明 。
链接 Visual Basic 脚本以复制 Config.xml
下面的过程介绍如何使用 Visual Basic 脚本复制 Config.xml 以进行 CacheOnly 安装。
链接 Visual Basic 脚本
共享想要在 CacheOnly 安装过程中复制到本地计算机的自定义 Config.xml 设置文件的副本。例如,\\server\share\config.xml。
将 Visual Basic 脚本文件(在此示例中为 copy_configxml.vbs)放在网络共享文件夹。
在定义 CacheOnly 设置(例如,cacheonly_config.xml)的 Config.xml 文件中,修改 Command 元素的 Path 属性以包含 Visual Basic 脚本文件 (copy_configxml.vbs) 的路径和文件名。若要修改 Config.xml 文件,请执行下列操作:
在文本编辑器工具(如记事本)中打开 Config.xml 文件。查找包含 Command 元素的行,如以下示例中所示:
<-- <Command Path="msiexec.exe" Args="/i \\server\share\my.msi" QuietArg="/q" ChainPosition="after" Execute="install" /> -->
通过想要使用的脚本的路径修改 Command 元素项。例如,使用下面的语法修改 Path 属性:
<Command Path="%windir%\system32\wscript.exe" Args="<path>\ filename.vbs " />
在此示例中,filename.vbs 为 copy_configxml.vbs。
有关 Config.xml 中 Command 元素的详细信息,请参阅 2007 Office system 中的 Config.xml 文件中的Command 元素。
使用包含 CacheOnly 设置的 Config.xml 文件安装 Office 2007。
完成前面的步骤之后,Office 2007 的安装文件通过自定义的 Config.xml 设置文件进行缓存。运行缓存的 Setup.exe 文件以使用包含在自定义 Config.xml 文件中的设置安装 Office。