Previous Section Table of Contents Next Section

Chapter 29. Logon and Logoff Scripts

IN THIS CHAPTER

Both NT and Active Directory domains allow you to specify logon scripts; Active Directory also allows you to specify a logoff script for users and computers. I'll provide some sample logon and logoff scripts that you can use as a starting point for building your own.

Perhaps one of the most common uses for scripting is the creation of logon (and, for Active Directory domains, logoff) scripts. A number of scripting languages have been created almost exclusively for use in these scripts, including Microsoft's unsupported Kixtart, the more general-purpose WinBatch, and many others. Dozens of command-line utilities exist that allow batch files to stand in as logon scripts. Although VBScript has a steeper learning curve than these other products, it also offers unmatched power and flexibility. VBScript's capability to use COM objects and directly access many operating system features allows it to immediately take advantage of new technologies and techniques.

Because every environment requires a unique logon script, it's impossible to offer examples that you can truly use without modification. Instead, I've tried to create examples that are modular, allowing you to pick and choose the various tasks you need for your own logon scripts. As a result, some of the tasks my examples perform are slightly less than real world. For example, you'll see examples where I'm using script to execute a relatively useless command-line utility. The point of the example isn't the utility itself, but rather the ability to execute external commands. You should be able to quickly modify the pieces of these examples to assemble your own highly useful scripts.

NOTE

I'm assuming that you know how to designate logon (and logoff) scripts for whatever domain environment you're working in. If you don't, consult the operating system's documentation for more information.


    Previous Section Table of Contents Next Section