thunder thunder54007 wrote:
> Hello, here is the problem.
> code like this in pythonwin:
> 
>>>> import wmi
>>>> c = wmi.WMI()
>>>> print c.Win32_NetWorkAdapter.AdapterTypeID
> None
>>>> print c.Win32_NetWorkAdapter.Availability
> None
>>>> print c.Win32_NetWorkAdapter.Caption
> None
>>>> print c.Win32_NetWorkAdapter.AdapterType
> None <[email protected]>
> 
> this same thing happed for class Win32_Keyboard, it seems that there is not
> value for these attributes, even the "Caption" attribute. why?

(I've probably misled you with some of the examples
exchanged in private email), Although the properties
& methods are visible via the WMI class, they won't
have any values until you pick a particular instance
of that class.

For *which* of your network adapters do you expect
to see values above? All of the WMI classes return
lists of their instances -- even when, as in the case
of Win32_OperatingSystem, there's obviously only one.

You need to do something like this:

<code>
import wmi
c = wmi.WMI ()

for nic in c.Win32_NetworkAdapter ():
   print nic.Caption
   print nic.AdapterTypeId
   print nic.Availability
   # or just
   # print nic

</code>

If you want a specific device, you'll have to pass in
some kind of identifying qualifier to the Win32_NetworkAdapter
call, eg:

<code>
import wmi
c = wmi.WMI ()

for nic in c.Win32_NetworkAdapter (
   Description="Cisco Systems VPN Adapter"
):
   print nic

</code>

TJG
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to