本帖最后由 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
这个变量在这里应该怎么写,格式有问题还是什么原因 |