Script to obtain IP address
Hi,
I have the following script to obtain an IPAddress from a laptop when it logs onto the domain. It works fine unless the laptop has more than one Ethernet (ie: wireless).
Does anyone know how to modify the script so that it ONLY returns the IP address of the internal LAN NIC and ignores Bluetooth, Wireless etc etc?
Ideally, script it to extract the IP where the DNS Suffix is our domain name, as shown from ipconfig in a command line for example.
Here is the script:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery _
("Select IPAddress from Win32_NetworkAdapterConfiguration Where DHCPEnabled=TRUE")
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
WScript.Echo IPConfig.IPAddress(i)
Next
End If
Next
Re: Script to obtain IP address
Hi Sid,
I made a new thread accidently.
Mods, could you please merge the thread?