My GroupedShutdowns script uses two techniques that you'll probably want to add to your scripting tool collection: multiple-usage routines and entry-point labels. Multiple-usage routines are a code-reuse technique, and entry-point labels provide a way to allow script flow to jump to a particular starting point.
Multiple-Usage Routines
In my Windows Scripting Solutions articles, I've often encouraged modularizing script code so that you can more easily leverage that code in future scripts. After your code is in production, you don't need to keep reinventing the wheel—just reuse the code, as I did with several code sections in the GroupedShutdowns script. While writing the script, I noticed that it ran a Ping routine three times and sent the Shutdown command twice. If I could just call the same Ping and Shutdown sections repeatedly, I could eliminate three-fifths of the script's code. Furthermore, if I needed to change code in the Ping or Shutdown modules, I could change it in just one module, rather than in several modules throughout the script. . . .

