Diatom Posted June 24, 2010 Posted June 24, 2010 My network has two Win 2003 servers each running a DHCP service. This means that when a lease expires it can be a race to to find the first available address from either server so machines frequently change IP address. I need to be able to keep track of the IP address history of each workstation on my network (300+ XP machines) for at least the previous 2 weeks. I know I can look up their present IP address in the DNS but I want a simple quick way to be able to check the IP a machine was using at any given time over the past fortnight. Bob
maniac Posted June 24, 2010 Posted June 24, 2010 This little script run as a startup script will log the current IP address of a workstation together with the date and time to a log file on the local C:\ With a little bit of tweeking it can be modified to store it on a central server with machine names etc. in seperate log files for each day, or in seperate log files for each machine etc. It's very badly written, I knocked it up sometime ago from various examples of other scripts on the net for a specific purpose when I was doing some troubleshooting, but it works. strcomputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery _ ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True") for each objitem in colitems strIPAddress = Join(objitem.IPAddress, ",") next IP = stripaddress strFile = "C:\IPaddressLog.txt" strText = date & " " & time & " " & IP Set objFSO = CreateObject("Scripting.FileSystemObject") If objFSO.FileExists(strFile) Then Else Set objFile = objFSO.CreateTextFile(strFile) End If Const ForAppending = 8 Set objTextFile = objFSO.OpenTextFile (strFile, ForAppending, True) objTextFile.WriteLine(strText) objTextFile.Close WScript.Quit 1
GrumbleDook Posted June 24, 2010 Posted June 24, 2010 I would also strongly recommend you got to DHCP reservations. Since most schools will have sufficiently large an IP range that they don't need to use DHCP for anything other than passing out centralised config then DHCP reservations will solve your problem. That way you should never have to worry about the problem at all. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now