Discussion Locked

Logging Users to IP addresses.

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Is there a variable to show User name, Ip Address, and Computer Name from a login script to a text file?

IE: %computername%, %username%, %ipaddress% > //networkserver/sharename/filename.txt

I want it to also log time logged on and off if possible.

6 replies

by frobo

Hi,

the answer is not easy but this functions very well:

----------- Inventory.cmd ------------------------
Echo off
Echo .
::First look if an old files Exisist and delete them
IF exist IPAdress.tmp del IPAdress.tmp
::Now we get the current Ipadress with IPconfig in a tmpfile
IPconfig >IPAdress.tmp
Echo .
::Now put all the info in one File
For /F "Skip=6 tokens=2,2* delims=:" %%a in (IPAdress.tmp) do @Echo %Computername% %Username% %%a %%b >>inventory.txt
Echo .
---------------------------------------------------------
This script functions only under NT (Server/Workstation) cause U don?t have the Environment variables like Computername and username und WIN9X by design !!

Hope it helps

Frobo

by frobo

Since it?s based on the For next loop, you get three lines per User in the central file: it looks like : Computer User IpAdress
Computer User Netmask, Computer User Gateway.

by jason.barnett

This is what we use:

echo %computername% >\\server_name\share_name\file_name.txt

echo %username% >>\\server_name\share_name\file_name.txt

ipconfig >>\\server_name\share_name\file_name.txt

This discussion is closed to new replies.