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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write IP and login_name to file

Status
Not open for further replies.

MrMajik

IS-IT--Management
Apr 2, 2002
267
Our DHCP table is a mess and I need a way to create a file on a network drive with either the computer name or IP address as part of the text file name, preferably both. I reseached the ipconfig/all > P:\??? as I am unable to pass the value of a variable to be part of the text file name. It does not have to be the ipconfig command. Any method of creating a little text file that has the computer name or IP address of the computer as part of the file name will work. This will be run in the ConsoleOne login script.

Thank you!
 
An easy way to do this would be to run a batch file in your login script and have the batch file contain something like:

ipconfig /all > p:\%computername%.txt

If you run this from a batch file, you should have no problems passing the variable.

--------------------------------------
"Insert funny comment in here!"
--------------------------------------
 
Tell me why you have a DHCP table when that can change at any time. If you had something like Windows WSUS server set up, it will show computer names and IP addresses and the IPs would be up to date every time the computer checks in to the server.

I used this along with an Excel file of computer names/who has the computer assigned to them to track computers easily. If I saw a computer that hadn't checked in in 8 days, I could look up who had it and then go over to "Joe" and find out why that might be.
 
The idea behind a 'dhcp table that changes all the time' is ridiculous. The dhcp service provides a lease time and many other configurable options and the dhcp client also keeps state. If you continually receive different addresses for
the same host then you should check your dhcp service configuration.

Are you logging your dhcp activity? If so it should be simple to extract the information you need from the logfile using perl or whatever.
 
Thanks to all who contributed on this.

I finally found a workable solution. In the Novell login script I put a command at user login level that runs ipconfig/all <computer name> and saves the result to a network folder all users have access to. This will give me the most current IP address for every computer name on the network segment. Because the little text file is being saved by the computer name.txt it deletes duplicate file names and replaces them witht the current result of ipconfig/all.

This is what I was hoping to achieve as there are hundreds of computers on these network segments I need to track.

FYI...There is a problem with the DHCP servers in our environment as sometimes one server is down. When this happens and I update the DHCP server with static addresses and it, too, goes down the IP information is not saved. This creates a nightmare when the "static" ip is given a lease to a different computer. Doing the ipconfig/all and saving it as the computer name is a simple solution. All I have to do is a search on the directiory with all the little text files for the IP address and within a second or two, POW!, the text file is opened.

Thank you,

MrMajik
 
Your network is a mess my friend!!! I feel sorry for you and those helping to support that system.
 
The network is healthy but not perfect. There are two DHCP servers that give us problems from time to time. With an enterprise environment this large (55,000 workstations) I am amazed it works as well as it does.

Thank you,

MrMajik

There are 10 types of people in the world:
Those that understand binary and those that don't.
 
Your problem is a design and philosophy problem, not a technical issue.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top