是否可以使用WMI脚本枚举所有(或仅启用)ActiveX元素(* .dll,* .ocx)?
答案 0 :(得分:1)
Scritomatic V2工具有一些样本:
On Error Resume Next
Const wbemFlagReturnImmediately = &h10 Const wbemFlagForwardOnly = &h20
arrComputers = Array("*") For Each strComputer In arrComputers WScript.Echo WScript.Echo "==========================================" WScript.Echo "Computer: " & strComputer WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\CIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ClassicCOMClass", "WQL", _ wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems WScript.Echo "Caption: " & objItem.Caption WScript.Echo "ComponentId: " & objItem.ComponentId WScript.Echo "Description: " & objItem.Description WScript.Echo "InstallDate: " & WMIDateStringToDate(objItem.InstallDate) WScript.Echo "Name: " & objItem.Name WScript.Echo "Status: " & objItem.Status WScript.Echo Next Next
Function WMIDateStringToDate(dtmDate) WScript.Echo dtm: WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _ Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _ & " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2)) End Function