|
-
Jul 23rd, 2008, 04:22 AM
#1
Thread Starter
Hyperactive Member
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
Last edited by ShiftySid; Jul 23rd, 2008 at 05:48 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|