Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WMI Query to determine DNS Servers without null entries

Tags:

wmi

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?

like image 420
John Calder Avatar asked May 29 '13 02:05

John Calder


2 Answers

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.

like image 192
RRUZ Avatar answered Sep 28 '22 07:09

RRUZ


Just use this

WHERE IPEnabled=True
like image 44
Jonathan Vince Avatar answered Sep 28 '22 08:09

Jonathan Vince