How to quickly obtain data from multiple workstations
Your company is purchasing a new application, so you need to make sure that 500 workstations have a certain service pack level installed on thema common task that script-savvy network administrators can easily perform. Typically, .bat and .cmd scripts that perform a task against a list of workstations consist of one line that performs the task and supportive code that connects to the workstation and returns error codes. Wouldn't it be nice if you didn't have to write the supportive code over and over again? A good practice is to reuse code that has already been tested and proven, but keeping track of numerous code snippets can be a challenge.
If you find yourself in this situation, try keeping just one master script that you can add operations to as needed. Letting one script grow in this fashion keeps your code centralized and within easy reach. Plus, it's truly reusable codenot copies of code in multiple scripts that can become outdated. Ideally, master scripts
- work off a list of workstations
- test each workstation to see whether it's a valid machine and powered on
- connect to each workstation
- perform whatever task you need
- log results and error codes
In .bat or .cmd scripts, you typically want code that you can implement easily and quickly. Thus, the master script must start out and remain easily modifiable. I created an easily modifiable script called Chkws, which I've tested on Windows NT 4.0 Service Pack 6 (SP6) through Windows 2000 SP2. Let's look at how Chkws works and how to add operations to it. . . .