Sometimes there is something that needs to be done on every computer on the network. It could be a registry setting or a file change. Whatever it may be, it sure is a pain to have to go out and manually make that change.

Well, this is exactly what I was faced with today. I needed to modify a text file on every computer on three different subnets. And each subnet was in a different city!

Needless to say, this would be very difficult to perform manually not to mention very time consuming. It is only logical to use the network. But, even to edit one file on all of the computers on the network can take some time and is a tedious task that I would not want to have to endure. So, I wrote a script.

The Script

The script that I wrote did a number of things. It would look at each subnet I specified one at a time. For each subnet it would ping the entire range of IP addresses available. If the IP address did not respond, it logged that the IP was not available and then went on to the next one.

If the IP address was available, it looked for the file that needed to be changed. If it did not find this file, it logged that the file did not exist and went on to the next IP address.

If this file did exist, it created a backup copy of the file with a .bak extension. It then searched for the appropriate entry in the text file and replaced it. Once it completed this task, it went on to the next IP address.

While all this was happening, it kept me in the loop by displaying a small tool tip in the upper left hand corner of the screen showing me the IP address is was working on.

Here is the actual script:
[syntax,UpdateFile.au3,AutoIt]

Conclusion

In the end, what could have taken me hours at best or days at worst ended up being a nice script project that I can re-use and it only took me a total of about an hour, including coding time and deployment (plus blogging, of course).

Feel free to copy the script and modify it so that it will work in your own environment. Hope it is useful

Trackback link - http://www.dailycupoftech.com/modify-every-computer-on-the-network/trackback/
Tim Fehlman

3 Responses to “Modify Every Computer on the Network”

  1. Aaron Says:

    I’ve been reading DCOT for about three weeks now and have found it both very interesting and useful. There is a lot of red tape with using new software on my company LAN which temporarily prevents me from using AutoIt and our SMS admins are not as timely with their help as we would like. Code this code be modified into a VB script to just delete a file or shortcut? Thank you in advance.

  2. Daily Cup of Tech Says:

    Installing Ubuntu Desktop Series Installing Ubuntu Desktop Part 1 Installing Ubuntu Desktop Part 2 Installing Ubuntu Desktop Part 3 Is Internet Explorer 7 Spying on Me? Linux from Scratch, The Saga Modify Every Computer on the Network Monitor Your Website With Google Alerts Multiple Computer Setup Perform MD5 Using AutoIt Providing User Feedback In AutoIt Recovering Your Lost Passwords Reducing the USB Threat Remote Control Mac From Windows

  3. Curtis Says:

    There is a tool that I believe you have mentioned before that would work well in this scenerio, psexec from SysInternals. This tool for me at least has proven itself time and time again.

    Curtis

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>