枚举本地计算机上已经安装的Hotfix

问:“如果我到添加与删除里面去看,需要逐个查看,慢慢啊!有什么好方法检查出我都安装了哪些补丁吗??”
Gnaw0725答:
测试环境:windows XP professional 英文版 MUI 简体中文 Service Pack 2 RTM
' ' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 3.1 ' ' NAME: Enumerate Installed Hotfixes.vbs ' ' COMMENT: 脚本执行后,将在当前目录下产生一个htm文件InstallHotfixes.htm,然后运行它,将当前计算机上已经安装的补丁列表出来。 ' '========================================================
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 BORDER=1 style=font-size:9pt>" objNewFile.WriteLine "<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 "</table>" objNewFile.WriteLine "</body>" objNewFile.WriteLine "</html>" objNewFile.Close Set objShell = Wscript.CreateObject("Wscript.Shell") objShell.Run "InstallHotfixes.htm"
------------------------------更新:2004-11-08-星期一-------------------
使用同样的方法,我们也可以枚举当前正在运行的进程
Set objWMI = _ GetObject("winmgmts:{impersonationLevel=impersonate}//./root/cimv2") Set colProcesses = objWMI.ExecQuery("SELECT * FROM Win32_Process") Set objFS = CreateObject("Scripting.FileSystemObject") Set objNewFile = objFS.CreateTextFile("CurrentProcess.htm") objNewFile.WriteLine "<html>" objNewFile.WriteLine "<head>" objNewFile.WriteLine "<title>Process Report</title>" objNewFile.WriteLine "</head>" objNewFile.WriteLine "<body>" objNewFile.WriteLine "<h1>Process Report -- Date: " & Now() & _ "</h1>" & vbCrLf objNewFile.WriteLine "<table BORDER=1>" For Each objProcess In colProcesses objNewFile.WriteLine "<tr>" objNewFile.WriteLine _ "<td>Process Name:</td><td>" & objProcess.Name & "</td>"
objNewFile.WriteLine "<td>Executable Path:</td><td>" & _ objProcess.ExecutablePath & "</td>" objNewFile.WriteLine "</tr>" Next objNewFile.WriteLine "</table>" objNewFile.WriteLine "</body>" objNewFile.WriteLine "</html>" objNewFile.Close Set objShell = Wscript.CreateObject("Wscript.Shell") objShell.Run "CurrentProcess.htm"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值