Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get local ip address 1

Status
Not open for further replies.

evenmoreUseless

Technical User
Jan 25, 2006
1
0
0
GB
I am trying to get a script batch file or any thing really to place on the desktop of all my users, that will tell them when they click on it what there local ip address is. I am well aware of using ipconfig and puase to get the cmd liune up but this still is a bit to complicated for some of my users. what i am after is a pop up boc or something along thoses line with nothing else on but the local ip. any help will be very much apricated

thaks in advance
 
I have just the thing!

I got a script courtesy of another member a while back to tell me information about DNS/Hostname/IP/Subnet/Gateway.

I have edited this script to give you exactly what you need.

Just paste the following into notepad, and save it as a .vbs file (VB Script) then when you double click, a popup will show up telling you the IP address:

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colAdapters = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

n = 1

For Each objAdapter in colAdapters



If Not IsNull(objAdapter.IPAddress) Then
For i = 0 To UBound(objAdapter.IPAddress)
WScript.Echo " Your Local IP address is: " & objAdapter.IPAddress(i)
Next
End If

n = n + 1

Next

Function WMIDateStringToDate(utcDate)
WMIDateStringToDate = CDate(Mid(utcDate, 5, 2) & "/" & _
Mid(utcDate, 7, 2) & "/" & _
Left(utcDate, 4) & " " & _
Mid (utcDate, 9, 2) & ":" & _
Mid(utcDate, 11, 2) & ":" & _
Mid(utcDate, 13, 2))

End Function





Hope that helps.

'When all else fails.......read the manual'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top