下面是vbs,能正常运行,用的是vbsedit里面的样本改了下' List Home Networking ICS Settings
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & _
"\root\microsoft\homenet")
Set colItems = objWMIService.ExecQuery _
("Select * from HNet_ConnectionProperties")
Dim net
For Each objItem In colItems
WScript.Echo "_________________________"
If objItem.IsICSPrivate Then
WScript.Echo "Is ICS Private: " & objItem.IsICSPrivate
End If
If objItem.IsICSPublic Then
WScript.Echo "Is ICS Public: " & objItem.IsICSPublic
End If
WScript.Echo "Connection: " & objItem.Connection
' Wscript.Echo "Is Bridge: " & objItem.IsBridge
' Wscript.Echo "Is Bridge Member: " & objItem.IsBridgeMember
' Wscript.Echo "Is Firewalled: " & objItem.IsFirewalled
' Wscript.Echo "Is ICS Private: " & objItem.IsICSPrivate
' 'private专用连接 一般是有线网卡?不知道能不能显示拨号连接
' Wscript.Echo "Is ICS Public: " & objItem.IsICSPublic
' 'public公用连接 一般是无线网卡?
Next' List Home Networking Connections
用vbs没问题,下面是au3代码,Local $meige
$strComputer = "."
$netstr = ObjGet("winmgmts:{impersonationLevel=impersonate}!\" & $strComputer & "\root\microsoft\homenet")
$colItems = $netstr.ExecQuery("Select * from HNet_ConnectionProperties")
;If IsObj($colItems) Then
For $meige In $colItems
ConsoleWrite($meige.Connection)
ConsoleWrite($meige.IsICSPrivate)
ConsoleWrite($meige.IsICSPublic)
Next
;EndIf
Variable must be of type "Object"............
For $meige In $colItems
For $meige In $colItems^ ERROR
为毛获取不了$colItems对象,这个应该没问题啊,难道差代码?
|