Created
November 7, 2016 17:44
-
-
Save cmbaughman/e81d487291c0ad64757645fe7cdde750 to your computer and use it in GitHub Desktop.
Simple Show IP Address for Windows Script Host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dim NIC1, Nic, StrIP, CompName | |
Set NIC1 = GetObject("winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration") | |
For Each Nic in NIC1 | |
if Nic.IPEnabled then | |
StrIP = Nic.IPAddress(i) | |
Set WshNetwork = WScript.CreateObject("WScript.Network") | |
CompName = WshNetwork.Computername | |
Dim WMI, Configs, Config, Adapters, Adapter | |
Set WMI = GetObject("winmgmts:{impersonationlevel=impersonate}root/cimv2") | |
' BEGIN CALLOUT A | |
Set Configs = WMI.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled=True") | |
' END CALLOUT A | |
For Each Config In Configs | |
' BEGIN CALLOUT B | |
Set Adapters = WMI.AssociatorsOf("Win32_NetworkAdapterConfiguration.Index=" & Config.Index, "Win32_NetworkAdapterSetting") | |
' END CALLOUT B | |
For Each Adapter In Adapters | |
'If Left(Adapter.Description, 14) = "Cisco AnyConnect VPN Virtual Miniport Adapter for Windows" Then | |
VPNIP = Config.IPAddress(0) | |
'End If | |
Next | |
Next | |
MsgBox "IP Address: "&StrIP & vbNewLine _ | |
& "VPN IP Address: "&VPNIP & vbNewLine _ | |
& "Computer Name: "&CompName ,4160,"IP Address and Computer Name" | |
wscript.quit | |
end if | |
next |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cara kontrol hp orang pakee IP gimna