WMI 查询以确定没有空条目的 DNS 服务器 [英] WMI Query to determine DNS Servers without null entries
问题描述
我可以使用以下 WMI 查询来确定我的机器可能正在使用的任何 DNS 服务器:
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?
推荐答案
WQL 语言 支持 !=
和IS [NOT] NULL
语法,问题是你选择的属性DNSServerSearchOrder
是一个数组,你可以'在 WQL Where 语句中使用数组属性.因此,解决方法是使用 的另一个属性Win32_NetworkAdapterConfiguration
where 条件下的 WMI 类.
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.
这篇关于WMI 查询以确定没有空条目的 DNS 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!