是否可以使用VBScript或命令行在Windows下获取PPP VPN的服务器IP?
请注意,这不是VPN拨号服务器IP。
答案 0 :(得分:0)
您可以使用VBScript从WMI获取信息。有很多网络脚本here。
例如,使用以下脚本获取给定网络适配器的IP。请务必提供您的VPN名称,而不是“Local Area Connection 2”字符串:
strComputer = "."
Set objWMIService = GetObject(_
"winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapter " _
& "Where NetConnectionID = " & _
"'Local Area Connection 2'")
For Each objItem in colItems
strMACAddress = objItem.MACAddress
Next
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration")
For Each objItem in colItems
If objItem.MACAddress = strMACAddress Then
For Each strIPAddress in objItem.IPAddress
Wscript.Echo "IP Address: " & strIPAddress
Next
End If
Next