由於 Windows 2000 Server 的[新增移除程式]中沒有[最近更新]選項,安全性更新也無法集中顯示微軟的 Hotfixs,有時候想檢查一下該Server是否有最新的安全性更新,實在是很麻煩。(Windows XP/2003 以上可以勾選[最近更新],並能集中歸類方便查看。)
以下的資料雖然有點舊,但是需要時還是能增加一些方便。
文章來源:枚舉本地計算機上已經安裝的Hotfix
(原帖的討論: http://www.winmag.com.cn/forum/itemdisplay.asp?boardid=5&id=501485)
討論區的程式碼比較完整,節錄如下:
在%systemroot%下會有hotfix安裝的時候產生的log,類似KB839645.log
也可以將下面的腳本保存為.vbs,執行它。
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colQuickFixes = objWMIService.ExecQuery _
("Select * from Win32_QuickFixEngineering")
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objNewFile = objFS.CreateTextFile("InstallHotfixes.htm")
objNewFile.WriteLine "<html>"
objNewFile.WriteLine "<head>"
objNewFile.WriteLine "<title>Installed Hotfixes Report</title>"
objNewFile.WriteLine "</head>"
objNewFile.WriteLine "<body>"
objNewFile.WriteLine "<h3>Hotfixes Report -- Date: " _
& Now() & "</h3>" & vbCrLf
objNewFile.WriteLine "<table style=font-size:9pt border=1>"
objNewFile.WriteLine "<tbody><tr>"
objNewFile.WriteLine "<td>Computer: </td>"
objNewFile.WriteLine "<td>Description:</td>"
objNewFile.WriteLine "<td>Hotfix ID:</td>"
objNewFile.WriteLine "<td>Installation Date:</td>"
objNewFile.WriteLine "<td>Installed By:</td>"
objNewFile.WriteLine "</tr>"
For Each objQuickFix in colQuickFixes
objNewFile.WriteLine "<tr>"
objNewFile.WriteLine "<td>" _
& objQuickFix.CSName & "</td>"
objNewFile.WriteLine "<td>" _
& objQuickFix.Description & "</td>"
objNewFile.WriteLine "<td>" _
& objQuickFix.HotFixID & "</td>"
objNewFile.WriteLine "<td>" _
& objQuickFix.InstallDate & "</td>"
objNewFile.WriteLine "<td>" _
& objQuickFix.InstalledBy & "</td>"
objNewFile.WriteLine "</tr>"
Next
objNewFile.WriteLine "</tbody></table>"
objNewFile.WriteLine "<body>"
objNewFile.WriteLine "<html>"
objNewFile.Close
Set objShell = Wscript.CreateObject("Wscript.Shell")
objShell.Run "InstallHotfixes.htm"
PS:記得將<>及空白的全型改成半型,
沒有留言:
張貼留言