Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > How to retrieve swbemobjectset collection from Async call?

Reply
Thread Tools Display Modes

How to retrieve swbemobjectset collection from Async call?

 
 
SeanInSeattle
Guest
Posts: n/a

 
      10-09-2008
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.


 
Reply With Quote
 
 
 
 
urkec
Guest
Posts: n/a

 
      10-10-2008
"SeanInSeattle" wrote:

> 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
 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Async Socket Communication Nadav Windows Vista Drivers 1 02-09-2009 10:01 AM
SWBemObjectSet :: Generic Failure Trevor Scripting 2 01-06-2006 12:05 PM
Sending Async Irp with IOCTL_HID_GET_FEATURE Angela Yan Windows Vista Drivers 3 09-02-2005 03:11 PM
1394 Async write Raj Windows Vista Drivers 4 11-28-2003 05:13 PM
1394 async broadcast Raj Windows Vista Drivers 2 07-03-2003 02:24 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59