如果你的用户名是administrator,可以试下这个
在 win7主机 + win7虚拟机 测试通过
其它用户名需要权限设置,有点烦的- rem 另存为 ANSI 编码 bat
- ' & cls & cscript.exe /nologo /e:vbscript "%~f0" & pause & exit
-
- Dim oSWbemLocator, oWMI, s, u, p
-
- s = "192.168.0.7"
- u = "administrator"
- p = "Aa12345678"
-
- Set oSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
- Set oWMI = oSWbemLocator.ConnectServer(s, "Root\Cimv2", u, p)
- s = "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True"
- For Each u In oWMI.ExecQuery(s)
- wsh.Echo u.Description
- wsh.Echo u.IPAddress(0)
- wsh.Echo
- Next
复制代码
|