Как перечислить все элементы ActiveX с WMI? - PullRequest
2 голосов
/ 28 апреля 2009

Можно ли перечислить все (или просто включить) элементы ActiveX (* .dll, * .ocx) с помощью сценария WMI?

Мотивация: ActiveXHelper

1 Ответ

1 голос
/ 29 апреля 2009

Инструмент Scritomatic V2 имеет такой пример:
<pre> On Error Resume Next</p> <p>Const wbemFlagReturnImmediately = &h10 Const wbemFlagForwardOnly = &h20</p> <p>arrComputers = Array("*") For Each strComputer In arrComputers WScript.Echo WScript.Echo "==========================================" WScript.Echo "Computer: " & strComputer WScript.Echo "=========================================="</p> <p>Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\CIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ClassicCOMClass", "WQL", _ wbemFlagReturnImmediately + wbemFlagForwardOnly)</p> <p>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</p> <p>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

...