I got a question from Murali:
“Suppose if I have a 100+ work group machines in the same network how can I run a script remotely against them? I would like to enter a range of IP address for my selection”
This is a tough one since Workgroup computers (Systems not joined to a domain) are not configured to allow this. This means we need to make sure:
-All the computers have the same administrator username and password
-File and printer sharing is opened in the firewall
-On Windows XP systems, simple file sharing must be disabled
Finally, none of the systems can be the “Home” edition of windows.
Why? Because Microsoft removes some network functionality that would make our task impossible.
Here are a few good guides on getting file and printer sharing open:
OK, Now that we got that covered, how do we get our list of computers in the script?
First, our script will take two arguments – the starting IP address, and the ending IP address. Then it will loop through all the ip addresses between them.
We do this by pulling each octet of the IP:
IPList = Split(StartIP, ".")
iS1 = cint(IPList(0))
iS2 = cint(IPList(1))
iS3 = cint(IPList(2))
iS4 = cint(IPList(3))
Then we run it through a for loop that calls a function for each IP we calculate. In the script I built, I called it ExecuteAction. For a test, I simply put an echo statement:
WScript.Echo "Host: " & HostName
Running it from the command line you can see it listed all of the IP addresses in the range I gave it (10.10.10.7 – 10.10.10.15):
So now we have a script that can enumerate our IP addresses. Just change the body of “ExecuteAction” and it will run against the range of IP addresses you provide.
You can get a copy of my script from here:
Just make sure to rename it to .vbs after downloading
One more thing…Subscribe to my newsletter and get 11 free network administrator tools, plus a 30 page user guide so you can get the most out of them. Click Here to get your free tools