本帖最后由 tianya1631 于 2010-4-11 11:35 编辑
下面是通过wmi获取系统已安装补丁的代码,现在问题是这样的:
当$objItem.HotFixID = file 1 时 $objItem.ServicePackInEffec = kbxxxxxx
当$objItem.HotFixID = kbxxxxxx 时 $objItem.ServicePackInEffec = spxxx
我怎么让他全部生成kbxxxxxx写入到记事本中,谢谢了!PS:我的粗心和理解错误,没有把问题表述清楚,在此谢谢afan版主的热心帮助。$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
Global $kb = '',$id = ''
$Output=""
$Output = $Output & "Computer: " & $strComputer & @CRLF
$objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_QuickFixEngineering", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
$ID = $ID&' '& $objItem.HotFixID &@CRLF
$kb = $kb&' '& $objItem.ServicePackInEffect &@CRLF
Next
;MsgBox(0,'',$ID)
;MsgBox(0,'',$kb)
FileWriteLine('fix.txt',$ID&@CRLF)
;FileWriteLine('fix.txt',$kb&@CRLF)
Else
Msgbox(0,"WMI 输出","No WMI Objects Found for class: " & "Win32_QuickFixEngineering" )
Endif
|