I can use the following WMI query to determine any DNS servers my machine might be using:
SELECT DNSServerSearchOrder
FROM Win32_NetworkAdapterConfiguration
However, the following query I wrote to ignore null entries is invalid and I don't know why:
SELECT DNSServerSearchOrder
FROM Win32_NetworkAdapterConfiguration
WHERE DNSServerSearchOrder!=null
Is there a way to filter out the null entries?
The WQL language supports !=
and the IS [NOT] NULL
syntax, the problem is the property which you choose DNSServerSearchOrder
is an array, and you can't use an array property in a WQL Where sentence. So the workaround is use another property of the Win32_NetworkAdapterConfiguration
WMI class in the where condition.
Just use this
WHERE IPEnabled=True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With