Discussion:
Enumerating through the results of a query
(too old to reply)
ollie jones
2009-07-20 14:49:02 UTC
Permalink
Hi,

I am using WMI to enumerate the network interfaces on the NICs, I have no
problem obtaining all of the information I need but have found that the first
time I try to access the enumerting objects for the Win32_NetworkAdapter and
Win32_NetworkAdapterConfiguration objects it takes several seconds.

Is there a way to either communicate with the WMI enumeration asynchronously
or to access the enumeration faster.

Regards,

Ollie
urkec
2009-07-21 15:43:01 UTC
Permalink
Post by ollie jones
Hi,
I am using WMI to enumerate the network interfaces on the NICs, I have no
problem obtaining all of the information I need but have found that the first
time I try to access the enumerting objects for the Win32_NetworkAdapter and
Win32_NetworkAdapterConfiguration objects it takes several seconds.
Is there a way to either communicate with the WMI enumeration asynchronously
or to access the enumeration faster.
Regards,
Ollie
If you're using WMI scripting API, it offers methods for asynchronous
operations:

http://msdn.microsoft.com/en-us/library/aa393854(VS.85).aspx


If you are using .Net Framework System.Management namespace,
ManagementObjectSearcher.Get() has an asynchronous overload:

http://msdn.microsoft.com/en-us/library/0w3ak0sb.aspx
--
urkec

My blog:
http://theadminblog.blogspot.com/

My CodeProject articles:
http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=4210975
ollie jones
2009-07-23 16:25:01 UTC
Permalink
Hi Urkec,

thanks for the response,

before I go down that route I just want to check something, I do not have
any problems with the call to ExecQuery or the
WbemScripting::ISWbemObjectSetPtr::Get_NewEnum as they seem to return fairly
instantaneously, however the call that takes in excess of a second is the
initial call to GetNext on the IEnumVARIANTPtr that is return from the
Get_NewEnum call, all successive calls after the intial call to GetNext are
also fairly instantaneous.

I can not see any asynchronous interface on the enumerating object. Can I
still acheive asynchronicity with the enumerator if I obtain ISWbemObjectSet
object asynchronously?

If not then am I likely to achieve the desired speed if I maybe try a
different approach like obtaining the SWbemObject pointer using the
Item/ItemIndex methods on the SWbemObjectSet pointer?

Regards,

Ollie
urkec
2009-07-23 16:44:01 UTC
Permalink
Post by ollie jones
Hi Urkec,
thanks for the response,
before I go down that route I just want to check something, I do not have
any problems with the call to ExecQuery or the
WbemScripting::ISWbemObjectSetPtr::Get_NewEnum as they seem to return fairly
instantaneously, however the call that takes in excess of a second is the
initial call to GetNext on the IEnumVARIANTPtr that is return from the
Get_NewEnum call, all successive calls after the intial call to GetNext are
also fairly instantaneous.
I can not see any asynchronous interface on the enumerating object. Can I
still acheive asynchronicity with the enumerator if I obtain ISWbemObjectSet
object asynchronously?
If not then am I likely to achieve the desired speed if I maybe try a
different approach like obtaining the SWbemObject pointer using the
Item/ItemIndex methods on the SWbemObjectSet pointer?
Regards,
Ollie
Sorry, I can't help you with WMI COM API.
--
urkec

My blog:
http://theadminblog.blogspot.com/

My CodeProject articles:
http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=4210975
Loading...