VISIT LIBRARY SPONSOR A BOOK HOW IT WORKS NEWSLETTER FEEDBACK
Enterprise Application Development
Enterprise Application Development

The Administrator Shortcut Guide to VB Scripting for Windows

by Don Jones

SYNOPSIS

Practically any Windows administration task can be automated. There are software developers that spend their careers creating tools to automate Windows administration. Even Microsoft provides Windows administration automation tools with command-line utilities such as Cacls.exe, which helps automate the process of changing NTFS file permissions. But as a Windows administrator, you probably think you don't have time to sit around programming your own automation tools. That's where you're wrong: VBScript offers a powerful, easy to understand scripting language that is practically tailor-made for Windows administration.

This guide will provide the basics of VBScript. Rather than attempt to show you every nook and cranny of VBScript—because you're probably more interested in just getting the job done, this guide will show you everything you need to know to get started with VBScript. In addition, there will be plenty of sample scripts to give you a little jump start.


CHAPTER PREVIEWS

Chapter 1: Introduction to VBScript

Have you ever run around to each computer on your network checking to see whether a particular patch was installed? Have you spent hours creating new user accounts and Exchange mailboxes for a batch of new users? Have you and a coworker walked around powering off client computers at the end of the day? In addition to these mundane duties, you’ve probably performed any number of tedious, time-consuming, repetitive tasks. Have you ever wondered if there was an easier way?

Practically any Windows administration task can be automated. There are software developers that spend their careers creating tools to automate Windows administration. Even Microsoft provides Windows administration automation tools with command-line utilities such as Cacls.exe, which helps automate the process of changing NTFS file permissions. But as a Windows administrator, you probably think you don’t have time to sit around programming your own automation tools. That's where you’re wrong: VBScript offers a powerful, easy to understand scripting language that is practically tailor-made for Windows administration.

This guide will provide the basics of VBScript. Rather than attempt to show you every nook and cranny of VBScript-because you’re probably more interested in just getting the job done, this guide will show you everything you need to know to get started with VBScript. In addition, there will be plenty of sample scripts to give you a little jump start.


Chapter 2: Working with ADSI

With all the hype about WMI, ADSI has been getting short shrift, which is a shame because ADSI is such a useful tool. A possible reason that ADSI is overlooked by most administrators is that it is poorly named. Many administrators assume that a tool named Active Directory Services Interface deals solely with AD. The truth is that ADSI can work with AD, but offers many additional capabilities.


Chapter 3: Working with WMI

Windows Management Instrumentation (WMI) is the most talked-about technology for managing Windows computers since… well, since TCP/IP, probably. Unfortunately, WMI comes across as the Windows equivalent to quantum physics—it seems complex, nobody’s really explaining it clearly, and the documentation requires a few degrees to understand.

The goal of this chapter is to clear some of the fog. It will steer clear from the technically deep, murky world of WMI and stick with the fun and easy-to-understand aspects of WMI. You’ll learn enough to use WMI in administrative scripts, which is most likely what you care about most.


Chapter 4: Advanced Scripting

Aside from the amazing things you can do with WMI and ADSI, scripting can provide a lot of additional functionality for making administration easier. For example, you can work with databases in a script, which gives you the ability to log WMI information into a SQL Server or Access database. In addition, the ability to run scripts on remote machines lets you extend your administrative reach and scope across your entire enterprise. In this chapter, I’ll touch on these and other advanced topics, giving you a head start toward making your scripts more powerful and flexible.