' *****************************************************************************
' TEST SCRIPT - officesource.vbs
' *****************************************************************************
' 作用: 设置Office源安装路径
' 作者: brinkman
' 日期: 2011.02.15 04.07
' Copyright (c) sunwill
' *****************************************************************************
On Error Resume Next
Const HKEY_CLASSES_ROOT = &H80000000
strComputer = "."
strFilePath = "" '定义office网络安装路径
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Installer\Products"
oReg.EnumKey HKEY_CLASSES_ROOT, strKeyPath, arrStrings
'从注册表strKeyPath键值下查询产品Microsoft Office Professional Edition 2003并定位安装路径
For i=0 To UBound(arrStrings)
strValueName = "ProductName"
strkeypath1 = "Installer\Products\" & arrStrings(i)
oReg.GetStringValue HKEY_CLASSES_ROOT, strkeypath1, strValueName, strValue1
If InStr(strValue1, "Microsoft Office Professional Edition 2003") Then
strkeypath2 = strKeyPath1
strOffVer = "Office2003\"
strFullPath = strFilePath
strfile = "PRO11.MSI"
End If
Next
'根据不同语言定位安装路径,只包含简体语言
strKeyPath3 = strKeyPath2
strValueName3 = "Language"
oReg.GetDWORDValue HKEY_CLASSES_ROOT,strKeyPath3,strValueName3,dwValue3
If dwValue3 = "2052" Then
strKeyPath4 = strKeyPath3 & "\" & "SourceList"
strValueName4 = "LastUsedSource"
strValue4 = "n;1;" & strFullPath
oReg.SetExpandedStringValue HKEY_CLASSES_ROOT,strKeyPath4,strValueName4,strValue4
strKeyPath5 = strKeyPath3 & "\" & "SourceList"
strValueName5 = "PackageName"
strValue5 = strfile
oReg.SetStringValue HKEY_CLASSES_ROOT,strKeyPath5,strValueName5,strValue5
strKeyPath6 = strKeyPath3 & "\" & "SourceList" & "\" & "Net"
strValueName6 = "1"
strValue6 = strFullPath
oReg.SetExpandedStringValue HKEY_CLASSES_ROOT,strKeyPath6,strValueName6,strValue6
End If
'更改Office 2003默认安装路径,取消本地缓存源
Dim OperationRegistry
Set OperationRegistry=WScript.CreateObject("WScript.Shell")
OperationRegistry.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Delivery\SourceEngine\Downloads\90000804-6000-11D3-8CFE-0150048383C9\Sources\90110804-6000-11D3-8CFE-0150048383C9\Path",strFilePath,"REG_SZ"
OperationRegistry.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Delivery\{90110804-6000-11D3-8CFE-0150048383C9}\CDCache","0","REG_SZ"
阅读(3078) | 评论(1) | 转发(0) |