Cover
Copyright
Contents at a Glance
Table of Contents
Introduction
I: Scripting with Windows Script Host
1 Windows Script Host
What Is a Windows Script?
Scripting Languages
A Simple Script
Types of Script Files
Creating Your First Script File
How Windows Runs Scripts
Running Your Own Scripts
Security Concerns
Debugging Scripts
Where to Get More Information
2 VBScript Tutorial
Introduction to VBScript
Flow Control
VBScript Functions
Interacting with the User
Advanced VBScript Topics
Where to Go from Here
3 Scripting and Objects
Introduction to Objects
Using Objects with VBScript
Using Objects with JScript
Using Objects with ActivePerl
Using Objects with ActivePython
Using the WScript Object
Locating and Using Unusual Objects
4 File and Registry Access
Getting Real Work Done
Manipulating Files and Folders
Reading and Writing Files
Reading and Writing XML
Manipulating Programs and Shortcuts
Working with the Environment
Working with the Registry
5 Network and Printer Objects
Managing Network and Printer Connections
Retrieving Network User Information
Managing Drive Mappings
Managing Network Printer Connections
Printing from Scripts
6 Messaging and Faxing Objects
Sending Email from Scripts with CDO
The CDO Object Model
Sending a Message with CDO
Faxing from Scripts
7 Windows Management Instrumentation
Introduction to Windows Management Instrumentation
Making WMI Connections
WMI Collections and Queries
Scriptomatic
WMI Examples
For More Information
8 Active Directory Scripting Interface
Managing the User Directory
ADSI Concepts
ADSI Objects for the WinNT: Provider
IIS and Exchange
Managing Active Directory
Active Directory Objects
Developing ADSI Scripts
EzAD Scriptomatic
For More Information
9 Deploying Scripts for Computer and Network Management
Using Scripts in the Real World
Using WSF Files
Deploying Scripts on a Network
Creating Simple Installation Programs with IExpress
Writing Scripts to Manage Other Computers
Scripting Security Issues
Setting Up Logon Scripts
Scheduling Scripts to Run Automatically
II: The Command Line Environment
10 The CMD Command-Line
The Command Prompt
Running CMD
Command-Line Processing
Configuring the CMD Program
Built-in Commands
Getting More Information
11 Batch Files for Fun and Profit
Why Batch Files?
Creating and Using Batch Files
Batch File Programming
Displaying Information in Batch Files
Argument Substitution
Argument Editing
Conditional Processing with If
Processing Multiple Arguments
Working with Environment Variables
Processing Multiple Items with the for Command
Using Batch File Subroutines
Prompting for Input
Useful Batch File Techniques
12 The MS-DOS Environment Under Windows
MS-DOS Programs on Windows
Configuring the MS-DOS Environment
MS-DOS and Networking
Printing from MS-DOS
Configuring Serial Communications with MS-DOS
Using Special-Purpose Devices for MS-DOS
Managing MS-DOS Programs
13 Command-Line Utilities
Windows Command-Line Programs
The Essential Command Line
GUI Shortcuts
General-Purpose Shell Programs
File-Management Tools
Management Power Tools
Networking Utilities
Getting More Utilities
III: Introduction to Windows PowerShell
14 Windows PowerShell
Introduction to Windows PowerShell
Obtaining Windows PowerShell
The PowerShell Environment
The PowerShell Command Prompt
Cmdlets and Objects and Scripts, Oh My!
Getting Help
Prompting to Complete Commands
Aliases
Navigating Directories and Other Locations
PowerShell Security
PowerShell Profiles
15 PowerShell Programming
The Windows PowerShell Programming Language
Windows PowerShell Syntax
Comments
Variables and Types
Expressions
Flow of Control
Exception Handling
Defining Functions
Using the .NET API
16 Using PowerShell
Real-World PowerShell
Command-Line Techniques
Formatting Cmdlet Output
Working with Files and Folders
Creating Useful Scripts
Using Hash Tables
The PowerShell Integrated Scripting Environment
Remote and Background PowerShell
Where to Go from Here
IV: Appendices
A: VBScript Reference
VBScript 5.6 Language Features
Syntax
General Structure of a VBScript Program
Data Types and Variables
Expressions and Operators
Program Statements
Functions
Predefined Special Values
VBA Features Omitted from VBScript
B: CMD and Batch File Language Reference
Batch File Argument and for Variable Replacement
Environment Variable Expansion
Predefined Environment Variables
Command Formatting
Built-in Commands
C: Command Line Program Reference
Administrative Tools
Built-in and Batch File Commands
DOS Commands
File-Management Commands
Handy Programs
Networking Tools
Software Development Aids
TCP/IP Utilities
Windows GUI Programs
D: Index of Patterns and Sample Scripts
Index of Patterns
Index of Sample Scripts and Batch Files
Index
A
B
C
D
E
G
H
I
J-K
L
M
N
O
P
Q-R
S
T
U
V
W
X-Y-Z
E: Automation Object Reference
Collection and Dictionary Objects
Script Management and Utility Objects
File Access Objects
XML/HTML Processing Objects
Program Environment Objects
Network and Printer Objects
Messaging Objects
Windows Management Interface (WMI) Objects
Active Directory Scripting Interface Objects
F: WSF and WSC File Format Reference
XML Conformance
Structure of a WSF
Structure of a WSC File
Tag Syntax
G: Creating Your Own Scriptable Objects
Why Create Your Own Objects?
Programming Language Options
Creating Objects with Windows Script Component Files
WSC File Format Reference
Creating a WSC
Creating a Practical Object