Get IP Address of AD Account logged in?

DemisE

Limp Gawd
Joined
Aug 21, 2004
Messages
164
Is there any dos commands or a script that I could run to query Active Directory/DHCP server to get the ipaddress of a user that is currently logged in by their userid?
 
It's fairly simple to use vbscript to collect the loggin in user's IP address.

I use a vbscript that runs ip config in a hidden window, redirects the output to a text file, parses the output text file, updates a file on a server share with the data, then deletes the text file created by ipconfig.

You can also use vbscript and WMI to directly query the IP address, then write the output to a server share. Just depends on whether or not you expect all the machines in your environment to support WMI.

Here's a "Hey, Scripting Guy!" column about getting IP addresses with WMI.
 
Are there any other alternatives that would be possible than the use of WMI? This would be for a global multi domain infastructure.
 
The first option in my first post.

OR

If you don't mind having to look through output to find the IP, you could just run ipconfig and pipe the output for each user to a separate file. You do have to determine the OS first in your batch file. If you are dealing with Win 9x boxes because prior to Windows 98 SE, ipconfig doesn't exist, and the format for the command on Win 98 SE and ME is different for them than for Windows NT based OS's.

On a NT OS, the following would do the job in the logon script.

ipconfig > \\server\share\%username%.txt

Included in the contents of the file is the IP address at the time of log on. Subsequent logons would overwrite previous ones.

I like my data in spreadsheet form, so I have the vbscript process it more than that.
 
Doesn't tyhe server keep a security log of all logon's I might be wrong but I remembered that Logon name and machine name was kept in that log.. Just resolve the machine name and voila you got what you need.
 
Back
Top