Microsoft VBScript Professional Projects
Jerry Lee Ford, Jr.
Copyright 2003 Premier Press, a division of Course Technology.
All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system without written permission from Premier Press, except for the inclusion of brief quotations in a review.
The Premier Press logo and related trade dress are trademarks of Premier Press and may not be used without written permission.
Microsoft is a registered trademark of Microsoft Corporation in the United States and/or other countries.
All other trademarks are the property of their respective owners.
Important: Premier Press cannot provide software support. Please contact the appropriate software manufacturer's technical support line or Web site for assistance.
Premier Press and the author have attempted throughout this book to distinguish proprietary trademarks from descriptive terms by following the capitalization style used by the manufacturer.
Information contained in this book has been obtained by Premier Press from sources believed to be reliable. However, because of the possibility of human or mechanical error by our sources, Premier Press, or others, the Publisher does not guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from use of such information. Readers should be particularly aware of the fact that the Internet is an ever-changing entity. Some facts may have changed since this book went to press.
1-59200-056-8
Library of Congress Catalog Card Number: 2003104025
03 04 05 06 07 BH 10 9 8 7 6 5 4 3 2 1
Premier Press, a division of Course Technology
25 Thomson Place
Boston, MA 02210
SVP, Retail and Strategic Market Group:
Andy Shafran
Publisher:
Stacy L. Hiquet
Senior Marketing Manager:
Sarah O'Donnell
Marketing Manager:
Heather Hurley
Manager of Editorial Services:
Heather Talbot
Acquisitions Editor:
Todd Jensen
Associate Marketing Manager:
Kristin Eisenzopf
Project Editor:
Argosy
Technical Reviewer:
Zac Hester
Retail Market Coordinator:
Sarah Dubois
Copy Editor:
Ginny Kaczmarek
Interior Layout:
Argosy
Cover Designer:
Mike Tanamachi
Indexer:
Elizabeth Hoff
Proofreader:
Christopher Mattison
Dedication
To Alexander, William, Molly, and Mary.
Acknowledgments
There are a number of people who deserve a lot of credit for their hard work on this book. I especially want to thank Todd Jensen for working with me as the book's acquisitions editor on yet another writing project. I also want to thank the book's project editor, Alex Bilsky, as well as its copy editor, Ginny Kaczmarek, for their excellence. Finally, I wish to thank Zac Hester, the book's technical editor, who has now worked with me on four different books.
About the Author
Jerry Lee Ford, Jr., is an author, educator, and IT professional with 15 years of experience in information technology, including roles as an automation analyst, a technical manager, a technical support analyst, an automation engineer, and a security analyst. Jerry is an MCSE and has also earned Microsoft's MCP and MCP + Internet certifications. In addition, he has a master's degree in business administration from Virginia Commonwealth University in Richmond, Virginia. Jerry is also the author of 11 other books, including Learn JavaScript in a Weekend, Learn VBScript in a Weekend, Microsoft Windows Shell Scripting and WSH Administrator's Guide, Microsoft WSH and VBScript for the Absolute Beginner, and Microsoft Windows XP Professional Administrator's Guide. He has over five years of experience as an adjunct instructor teaching networking courses in information technology. Jerry lives in Richmond, Virginia, with his wife, Mary, and their children, Alexander, William, and Molly.
Goal of This Book
The goal of this book is to provide programmers, power users, and system administrators who have a previous programming background with a project-oriented approach to learning the VBScript (Visual Basic Scripting) language. VBScript is a member of the Visual Basic family of programming languages that includes both Visual Basic and VBA (Visual Basic for Applications).
VBScript is a scripting language that acts as a tool for rapid application development in a host of different operating environments. VBScript provides the ability to automate tasks on Windows operating systems using the WSH (Windows Script Host). The WSH provides VBScripts with access to Windows resources, such as the Windows file system, the desktop, the registry, and network resources. In addition, when combined with HTML and executed within Internet Explorer, VBScript allows the user to create interactive client-side Web content.
The book's opening chapters provide a complete review of VBScript, covering all the elements that make up this scripting language. The bulk of the book focuses on exploring the implementation of four scripting projects, each of which is based on a real-life scenario. In the first project, VBScript and the WSH are used to assist a small team of desktop engineers with the customization and deployment of new computers. The second project demonstrates how VBScript and the WSH can be used to assist a team of programmers analyzing reports generated by a collection of applications for which they are responsible. The third project builds upon the work performed in the second project by demonstrating how to establish a centralized management reporting station where the programmers can view summary reports based on data retrieved from distributed computers. The final project demonstrates how to use VBScript, the WSH, and Internet Explorer to create dynamic Web content that displays information extracted from data generated by the third project.
One of the powerful capabilities provided to VBScript by the WSH is the ability to execute any Windows command. This capability is exploited by the projects presented in this book. provides a description of the book's companion Web site, where copies of all the scripts presented by the book can be downloaded.
What You Need to Begin
This book covers VBScript within the context of two different execution environments, the WSH and Internet Explorer. In order to be able to effectively use VBScript with the WSH, you will need a number of tools, including:
A computer running a Windows operating system
WSH version 5.6, which can be obtained for free at http://msdn.microsoft.com/scripting
A plain text editor, such as the Windows Notepad application, or a script editor that can be used to create plain text files
Access to one or more computers on a local area network in order to complete the third project
In order to be able to use the information provided in the book for Web page development, you will need access to the following tools:
A computer running a Windows operating system
Internet Explorer and copies of any other Internet Explorer compatible browsers that you plan to support in order to test the display of your Web content
A plain text or script editor
Conventions Used in This Book
This book includes a number of special elements that are designed to make it easier for you to read and work with. These special elements are outlined below: