由于WSUS升级到了3.0,发现很多客户端无法连接到WSUS服务器,原因是客户端的wsus update agent版本过低引起的。
如果运行本脚本后发现需要升级agent则可以去微软官方网站下载最新的agent3.0解决此问题。(http://support.microsoft.com/kb/949104/zh-cn)
操作:复制以下代码另存为WsusAgent30Chk.vbs
- '==Program Start==
- Const WINDOWS = &H24&
-
- Set objShell = CreateObject("Shell.Application")
- Set objFolder = objShell.Namespace(WINDOWS)
- Set objFolderobjFolderItem = objFolder.Self
-
- strWinPath = objFolderItem.Path
- strDrvPath = Mid(strWinPath, 1, 3)
- strWinLen = Len(strWinPath)
- strNum = strWinLen - 3
- strWinName = Mid(strWinPath, 4, strNum)
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- strFullpath = strDrvPath & "\" & strWinName & "\\system32\\wuaueng.dll"
-
- strComputer = "."
-
- Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
- Set colFiles = objWMIService.ExecQuery("SELECT * FROM CIM_DataFile where name = '" & strFullpath & "'")
- For Each objFile in colFiles
- strVer = objFile.Version
- Next
-
- strVerCur = Mid(strVer, 1, 12)
- 'Wscript.Echo strVerCur
- strVerNew = "7.2.6001.788"
- If strVerCur >= strVerNew Then
- Wscript.Echo "No need to update Agent"
- Else
- Wscript.Echo "Need update to Microsoft update Agent 3.0"
- End If
- '==Program End==
本文转自yangye1985 51CTO博客,原文链接:http://blog.51cto.com/yangye/198616,如需转载请自行联系原作者