Hello everyone.
I am writing a user-mode program that manages NICs concently.
But I don’t know how to get NIC’s status(for example NIC is enabled
or not, NIC’s cable is connected or not)
Does anyone know the method?
Thanks.
Hello everyone.
I am writing a user-mode program that manages NICs concently.
But I don’t know how to get NIC’s status(for example NIC is enabled
or not, NIC’s cable is connected or not)
Does anyone know the method?
Thanks.
Use WMI.
This is a script that will dump out lots of info on your attached NICs.
I think Availability and NetConnectionStatus under win32_networkadapter are
what you are looking for. You can also do it from C.
set svc = GetObject(“winmgmts:\root\cimv2”)
set NetAdapterConfigEnum = svc.ExecQuery(“select * from
win32_networkAdapterConfiguration where ipEnabled = true”, “WQL”, 32)
for each obj in NetAdapterConfigEnum
wscript.echo obj.GetObjectText_
strQuery = “associators of {” & obj.path_.relpath & “} where resultclass
= win32_networkadapter”
set NetAdapterEnum = svc.execQuery(strQuery, “WQL”, 32)
for each objAdapter in netadapterenum
wscript.echo objAdapter.GetObjectText_
next
next
Marc Reinig
System Solutions
“Akio Yamamoto” wrote in message news:xxxxx@ntdev…
>
> Hello everyone.
>
> I am writing a user-mode program that manages NICs concently.
> But I don’t know how to get NIC’s status(for example NIC is enabled
> or not, NIC’s cable is connected or not)
>
> Does anyone know the method?
> Thanks.
>
>