Overview of Scripting Guidelines

Microsoft® Windows® 2000 Scripting Guide

When you write a script, you should always consider how the script might be used in the future. Some scripts are disposable by design: they are written once, they are run once, and then they are never used again. These scripts might resolve unique situations, or be so short and easy to write that there is no need to maintain them. Should the need arise again, you can easily re-create the script. This is one of the benefits of scripting: you can make the process as formal or as informal as needed.

Other scripts might be run repeatedly or be copied and used by other administrators. These administrators might need to modify the scripts to fit their own needs. At the very least, they will probably want to view the script code so they can better understand what the script actually does, and how. In these situations, it is a good idea if your scripts follow accepted organizational standards for such things as commenting, formatting, and naming; following these standards makes it easier for others to read, modify, and maintain the scripts.

As you read this chapter, keep in mind that everything suggested here is just that: a suggestion. You need not implement each guideline in every script; after all, a two-line script that maps a network drive probably does not need a 12-line script header and multiline comments. The first rule of script writing is: Never make things more complicated than they need to be.

Preparing for Visual Basic .NET

The scripts used in this chapter are written in Microsoft® Visual Basic® Scripting Edition (VBScript). Throughout this chapter, you will find notes that compare VBScript with the .NET programming languages (in particular, Microsoft® Visual Basic® .NET). If you plan to move to Visual Basic .NET, keep these notes in mind when you choose scripting guidelines for your organization, Although the scripts you write now cannot be copied as is into Visual Basic .NET, it is easier to manually convert scripts if you adopt the .NET standards now.