General discussion

Locked

inventory IP addresses

By eddie_is_okay ·
Hi is there an easier way or automated way to collect and inventory our IP addresses?

we run a DHCP server but the addresses are not pooled. IP is assigned to the same MAC address so we can remote control to the machine when we need to help user.

the IP address matrix is a nightmare. it does not get updated properly and regularly. we constantly keep running into conflicts and so on.

i dont have the time to go around and redo the entire matrix from scratch. ideally - we need a matrix that lists:
IP / MAC / USER / MACHINE

what i have been doing it telneting to the switches and copy/pasting the MAC listing, then pinging and ARPing to get correct IP to MAC. i still can't get the user name though. it's a very long and gut wrenching process.

i am wondering if any out there in the community have any good tips, tricks or advice on how to do this quickly, automatically and efficiently.

we don't run or have SNMP setup. not allowed by senior staff.

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Comercial Software

by jdmercha In reply to inventory IP addresses

There are a lot of comercial software packages out there that will do just that. But if you are not willing to pay for a product you can modify this VB script to suite your needs:

Option Explicit
Dim Row, XL, WshShell, FileSystem, RegularExpression, Dummy, TheNVFile, TheLine
Dim Whacks, WhacksFound, WhacksPattern, Flag, HostName, NBTable, PingReport, PingPattern
Dim IPAddress, MACPattern, NamePattern, MACAddress, Matches, TheMatch, Match, NBCommand, TheNBTFile, PCname
Dim IPCommand, TheIPFile, FileName, TheDate, Suggestion, Book

Const ForReading = 1
Row = 2

Set XL = WScript.CreateObject("Excel.Application")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set FileSystem = CreateObject("Scripting.FileSystemObject")
Set RegularExpression = New RegExp

Dummy = WshShell.Popup ("Compiling Network Address Inventory. Please Wait...",1,"Network Address Inventory Utility",64)

Call BuildSpreadSheet()

Set TheNVFile = FileSystem.OpenTextFile("C:\Windows\Temp\NetViewList.txt", ForReading, True)

Do While TheNVFile.AtEndOfStream <> True
TheLine = TheNVFile.ReadLine
Whacks = "\\"
WhacksFound = FindPattern(TheLine, Whacks)
If WhacksFound Then
WhacksPattern = "\\\\\S*"
Flag = "1"
HostName = GetPattern(TheLine, WhacksPattern, Flag )

NBTable = GetNBTable(HostName)
MACPattern = "MAC Address = \S*"
Flag = "2"
MACAddress = GetPattern(NBTable, MACPattern, Flag )
NamePattern = "\S* <"
FLAG = "4"
PCname = GetPattern(NBTable, NamePattern, Flag )
PCname = Replace(PCname, " <", "")

PingReport = GetIPAddress(HostName)
PingPattern = "Reply from \S*"
Flag = "3"
IPAddress = GetPattern(PingReport, PingPattern, Flag )
IPAddress = Replace(IPAddress, ":", "")
Call AddToSpreadSheet(HostName, IPAddress, MACAddress, PCname)
End If
Loop

TheNVFile.Close
FileSystem.DeleteFile("C:\Windows\Temp\NetViewList.txt")
Dummy = WshShell.Popup ("Network Address Inventory Operation Complete",5,"Network Address Inventory Utility",64 )
Call SaveSpreadSheet()
Wscript.Quit

Sub BuildSpreadSheet()
XL.Visible = True
Set Book = XL.WorkBooks.Add
XL.Columns(1).ColumnWidth = 20
XL.Columns(2).ColumnWidth = 20
XL.Columns(3).ColumnWidth = 20
XL.Columns(4).ColumnWidth = 20
XL.Cells(1, 1).Value = "Host Name"
XL.Cells(1, 2).Value = "IP Address"
XL.Cells(1, 3).Value = "MAC Address"
XL.Cells(1, 4).Value = "PC Name"
XL.Range("A1:D1").Select
XL.Selection.Font.Bold = True
XL.Selection.Font.Size = 12
End Sub

Sub AddToSpreadSheet(HostName, IPAddress, MACAddress, PCname)
XL.Cells(Row, 1).Value = HostName
XL.Cells(Row, 2).Value = IPAddress
XL.Cells(Row, 3).Value = MACAddress
XL.Cells(Row, 4).Value = PCname
Row = Row + 1
XL.Cells(Row, 1).Select
End Sub

Sub SaveSpreadSheet()
TheDate = Date
TheDate = Replace(TheDate, "/", "-")
Suggestion = "NetAI " & TheDate & ".xls"
FileName = XL.GetSaveAsFilename(Suggestion)
If FileName <> False Then
Book.SaveAs(FileName)
End If
End Sub

Function FindPattern(TheText, ThePattern)
RegularExpression.Pattern = ThePattern
If RegularExpression.Test(TheText) Then
FindPattern = "True"
Else
FindPattern = "False"
End If
End Function

Function GetPattern(TheText, ThePattern, Flag)
RegularExpression.Pattern = ThePattern
Set Matches = RegularExpression.Execute(TheText)
For Each Match in Matches
TheMatch = Match.Value
If Flag = "1" Then TheMatch = Mid(TheMatch, 3)
If Flag = "2" Then TheMatch = Mid(TheMatch, 14)
If Flag = "3" Then TheMatch = Mid(TheMatch, 11)
If Flag = "4" Then TheMatch = Mid(Thematch, 1)
Next
GetPattern = TheMatch
End Function

Function GetNBTable(HostName)
NBCommand = "nbtstat -a " & HostName
WshShell.Run "command.com /c " & NBCommand &" > C:\Windows\Temp\NBTList.txt", 2,True
Set TheNBTFile = FileSystem.OpenTextFile("C:\Windows\Temp\NBTList.txt", ForReading, True)
GetNBTable = TheNBTFile.ReadAll
TheNBTFile.Close
FileSystem.DeleteFile("C:\Windows\Temp\NBTList.txt")
End Function

Function GetIPAddress(HostName)
IPCommand = "ping -n 1 " & HostName
WshShell.Run "command.com /c " & IPCommand &" > C:\Windows\Temp\IPList.txt", 2,True
Set TheIPFile = FileSystem.OpenTextFile("C:\Windows\Temp\IPList.txt", ForReading, True)
GetIPAddress = TheIPFile.ReadAll
TheIPFile.Close
FileSystem.DeleteFile("C:\Windows\Temp\IPList.txt")
End Function

Collapse -

Or you could just download a freeware product...

by TomSal In reply to Comercial Software

Unless I'm mistaken you are asking for an IP scanner that scans your lan and provides a list of all IPs on the lan, their MAC's, the Netbios name of the machine and the like...

There are a ton of FREEWARE utilites that do this job.

My favorite is a tool called "Angry IP Scanner".

Unfortunately I don't have the URL for it right now but if you google the name or if you search for it at download.com I'm sure you'll find it, that's all I did to get it.

Collapse -

VBSCRIPT???

by Jaqui In reply to Comercial Software

useless, unless you are running winders.
it doesn't work on a mac, or on an *x system.

and my own network would toss it out at first contact.
no proprietary tech admitted.

Collapse -

True

by jdmercha In reply to VBSCRIPT???

It will run from an XP machine, but it will return information from anything with an IP address. But the information will be more complete from a Windows machine.

Collapse -

NetworkView

by john_knickerbocker@altico In reply to inventory IP addresses

I use networkview It cost about $20.00 US.
Collects everything with anIP address and can tell if it is a CPU, Server or Printer.
http://www.networkview.com/

Collapse -

by Choppit In reply to inventory IP addresses

3 Com Network Administrator wil do this for you.

Collapse -

Limit IP scope

by Solver2121 In reply to inventory IP addresses

How can I limit the ip range of this script to only search the x.x.155.x segment of my network?

Thank you

Back to IT Employment Forum
7 total posts (Page 1 of 1)  

General Discussion Forums