关于select from的一点疑问
本帖最后由 yongzhai 于 2011-11-17 13:31 编辑我先定义一个变量$netname为一张网卡的名称,然后通过网卡的名称来获取此网卡的IP,问题是我用以下语句来获取总是失败,返回值为空
$colNIC = $objWMIservice.ExecQuery("Select * from Win32_NetworkAdapter WHERE Netconnectionstatus = 2 and name != 'MS TCP Loopback interface'And name != 'VMware Virtual Ethernet Adapter for VMnet8' and name != 'Microsoft TV/Video Connection' and name != '1394 网络适配器'")
For $object in $colNIC
$netname = StringStripWS($object.name ,1)
Next
$ip = $objWMIservice.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration where Description =" $netname)
for $objext in $ip
$ipadd = stringstripws($object.ipaddress,1)
next
这个变量在这里应该怎么写,格式有问题还是什么原因 有没人知道呀,自己顶一下 $ip = $objWMIservice.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration where Description =" &$netname)
试下 还是不行,获取的IP总是空的 只能说你定义有错误{:face (411):} 为什么不用@IPAddress1来获得IP地址?虽然有时候会得到127.0.0.1的IP地址 @ipaddress1获取的有时候是0.0.0.N之类的IP,或者是空的,我的代码如下,高手帮我看看
$colNIC = $objWMIservice.ExecQuery("Select * from Win32_NetworkAdapter WHERE Netconnectionstatus = 2 and name != 'MS TCP Loopback interface'And name != 'VMware Virtual Ethernet Adapter for VMnet8' and name != 'Microsoft TV/Video Connection' and name != '1394 网络适配器'")
For $object in $colNIC
$netname = StringStripWS($object.name ,1)
Next
$ip = $objWMIservice.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration where Description =" $netname)
for $objext in $ip
$ipadd = stringstripws($object.ipaddress,1)
next
怎么没人来呀,高手在哪里呀,郁闷....... $ip = $objWMIservice.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration where Description = '" & $netname & "';") 楼上的方法还是不行呀,返回为空 贴子不要沉了,问题还没有解决呢 晕倒,没人理我呀,
页:
[1]