您的位置:首页 > 其它

使用脚本巧解office安装源问题(修正版)

2010-04-15 21:12 288 查看
最近由于由于给客户端下派office补丁导致大量客户计算机office组件无法正常使用,弹出某个文件定位的一个提示窗口,造成该问题的主要原因是由于office后续的核心组件或者关键组件更新时需要使用到源安装路径或者源安装光盘或者源安装缓存(MSOcache)。如果源路径不存在或者缓存丢失,就造成上述现象。

如何避免上述问题或者发生之后如何解决?
1.安装完office后,再最后完成的那一页不要选择删除“安装缓存”,安装缓存会存放在剩余空间最大的分区中,命名为MSOcache(隐藏文件)。如果保存了安装缓存将不会造成上述问题。

2.如果公司的客户端全部是做的ghost镜像并且没有保留缓存,那就只有使用组策略下派脚本来批量解决问题了。
解决思路:修改注册表中的office缓存文件定位路径。

office注册表路径:
HKEY_CLASSES_ROOT\Installer\Products\*
其中*为一个字符串值,例如
4080110900063D11C8EF10054038389C或9040110900063D11C8EF10054038389C

复制以下代码为OfficeSource.vbs,然后通过组策略下发。

On Error Resume Next
Const HKEY_CLASSES_ROOT = &H80000000
strComputer = "."
strFilePath = "\\Filesrv\Software\Office\"  '定义office网络安装路径
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Installer\Products"
oReg.EnumKey HKEY_CLASSES_ROOT, strKeyPath, arrStrings

'从注册表strKeyPath键值下查询产品Microsoft Office 2000 SR-1 Professional和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 2000 SR-1 Professional") Then
strkeypath2 = strKeyPath1
strOffVer = "Office2000\"
strFullPath = strFilePath & strOffVer
strfile = "DATA1.MSI"
End If
If InStr(strValue1, "Microsoft Office Professional Edition 2003") Then
strkeypath2 = strKeyPath1
strOffVer = "Office2003\"
strFullPath = strFilePath & strOffVer
strfile = "PRO11.MSI"
End If
Next

'根据不同语言定位安装路径,只包含简、繁、英、日四种。
strKeyPath3 = strKeyPath2
strValueName3 = "Language"
oReg.GetDWORDValue HKEY_CLASSES_ROOT,strKeyPath3,strValueName3,dwValue3
If dwValue3 = "2052" Then
strLang = "CN\"
strKeyPath4 = strKeyPath3 & "\" & "SourceList"
strValueName4 = "LastUsedSource"
strValue4 = "n;1;" & strFullPath & strLang
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 & strLang
oReg.SetExpandedStringValue HKEY_CLASSES_ROOT,strKeyPath6,strValueName6,strValue6
Elseif dwValue3 = "1028" Then
strLang = "TC\"
strKeyPath4 = strKeyPath3 & "\" & "SourceList"
strValueName4 = "LastUsedSource"
strValue4 = "n;1;" & strFullPath & strLang
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 & strLang
oReg.SetExpandedStringValue HKEY_CLASSES_ROOT,strKeyPath6,strValueName6,strValue6
Elseif dwValue3 = "1041" Then
strLang = "JP\"
strKeyPath4 = strKeyPath3 & "\" & "SourceList"
strValueName4 = "LastUsedSource"
strValue4 = "n;1;" & strFullPath & strLang
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 & strLang
oReg.SetExpandedStringValue HKEY_CLASSES_ROOT,strKeyPath6,strValueName6,strValue6
Elseif dwValue3 = "1033" Then
strLang = "EN\"
strKeyPath4 = strKeyPath3 & "\" & "SourceList"
strValueName4 = "LastUsedSource"
strValue4 = "n;1;" & strFullPath & strLang
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 & strLang
oReg.SetExpandedStringValue HKEY_CLASSES_ROOT,strKeyPath6,strValueName6,strValue6
End If
本文出自 “Leaves驿站” 博客,请务必保留此出处http://yangye.blog.51cto.com/922715/295811
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: