Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: How to retrieve swbemobjectset collection from Async call?

HTVi
TV Discussion Newsgroups

How to retrieve swbemobjectset collection from Async call?
SeanInSeattle 10/9/2008 10:24:01 PM
So, does anyone know how to get the collection / swbemobjectset from an
asynchronous call to WMI on-completed()...? And, also does anyone know how
to get the collection when its not fully done?

It seems like it should be possible.... but I'm racking my brain trying to
find an answer.


RE: How to retrieve swbemobjectset collection from Async call?
urkec 10/10/2008 7:14:00 PM
"SeanInSeattle" wrote:

[Quoted Text]
> So, does anyone know how to get the collection / swbemobjectset from an
> asynchronous call to WMI on-completed()...? And, also does anyone know how
> to get the collection when its not fully done?
>
> It seems like it should be possible.... but I'm racking my brain trying to
> find an answer.
>
>


Here is a sample:


Set objSWbemServices = GetObject _
("winmgmts:\\.\root\cimv2")

Set objSink = WScript.CreateObject _
("WbemScripting.SWbemSink","objSink_")

objSWbemServices.ExecQueryAsync _
objSink, "Select * From CIM_DataFile " & _
"Where Path = '\\windows\\system32\\'"

MsgBox "Waiting for objects!"


Sub objSink_OnCompleted(iHRes, objWmiErr, objCntxt)
WScript.Echo VbCrtLf & "Async call completed."
End Sub

Sub objSink_OnObjectReady(objWmiObj, objCntxt)
WScript.Echo objWmiObj.FileName
End Sub



MsgBox prevents the script from ending. objSink_OnObjectReady receives
CIM_DataFile instances asynchronously (as objWmiObj) and echoes their
FileName property. When the call is completed objSink_OnCompleted is
triggered.
I'm not sure if it is possible to get the collection of WMI objects as a
SWbemObjectSet object with an asynchronous call.


--
urkec

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen