User Tools

Site Tools


vbs:localhostinfo

Localhost Info

Ottiene le informazioni sulla scheda di rete ed eventuale adapter VPN restituendo i due IP interni e il nome macchina. Lo script originale è disponibile all'indirizzo community.spiceworks.com/topic/post/1612511

localhostinfo.vbs
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)
CompName = WshNetwork.Computername
Dim WMI, Configs, Config, Adapters, Adapter
Set WMI = GetObject("winmgmts:{impersonationlevel=impersonate}root/cimv2")
Set Configs = WMI.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled=True")
For Each Config In Configs
Set Adapters = WMI.AssociatorsOf("Win32_NetworkAdapterConfiguration.Index=" & Config.Index, "Win32_NetworkAdapterSetting")
For Each Adapter In Adapters
VPNIP = Config.IPAddress(0)
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
vbs/localhostinfo.txt · Last modified: 2013/02/27 12:22 by Giovanni