"Finally, a step-by-step VBScripting book to make you look
like a programmer without the time and sweat! Don't waste your time
searching the Internet for examples--this book does it for
you!" http://www.dropshippers.co.za/
--Greg A. Marino, Senior Systems Engineer/Consultant, Westtown
Consulting Group, Inc. http://www.dropshippers.co.za/
Visual Basic Scripting (VBScript) and Windows Management
Instrumentation (WMI) are vital tools for systems administrators
grappling with the increasing complexity of Windows technologies.
However, busy admins have been without a straightforward guide to
scripting...until now. http://www.dropshippers.co.za/
Managing Windows® with VBScript and
WMI explains how Windows administrators can
effectively use VBScript to automate common administrative tasks
and simplify complex ones. Detailed coverage of security concerns
provides admins with the means for safely using VBScript in Windows
environments. The book is organized around the problems you face
daily, with reusable examples and coverage of Windows NT, Windows
2000, Windows XP, and Windows 2003. http://www.dropshippers.co.za/
This user-friendly reference demystifies scripting and then
shows you how to produce new scripts from scratch. You will be
producing useful scripts right away as you study the VBScript
language and learn how to control nearly every aspect of the
Windows operating system with WMI and the Active Directory Services
Interface (ASDI). You will be able to build your own administrative
Web pages and use advanced scripting technologies such as script
encryption, scripting components, and script security. The book
closes with still more ready-made example scripts accompanied by
complete line-by-line explanations. The CD includes all the code
from the book and trial versions of PrimalScript 3.0 and VbsEdit. A
companion Web site provides updates and errata. http://www.dropshippers.co.za/
Inside you will find answers to such questions as: http://www.dropshippers.co.za/
- How do you write effective logon scripts? Chapter
11
- How do you write scripts that query and modify user and group
information? Chapter 16
- How can you query the IP addresses from multiple network
adapters in multiple remote computers? Chapter 19
- How can you design, write, run, test, and debug your own
administrative Web pages? Chapter 24
- How can you reuse code between various scripts? Chapter
25
http://www.dropshippers.co.za/
The definitive guide to scripting for all Windows
administrators, helping them to simplify their work and make their
network more secure. http://www.dropshippers.co.za/
° Demystifies scripting for administrators, showing how VBScript
and WMI can help ease repetitive or complex tasks http://www.dropshippers.co.za/
° Organized around tasks, and heavily cross-referenced, allowing
quick access to information of immediate value http://www.dropshippers.co.za/
° Based on the author's years of experience teaching and
training http://www.dropshippers.co.za/
° Most other books on scripting focus on developers, not
administrators http://www.dropshippers.co.za/
Table of Contents
Preface xxi http://www.dropshippers.co.za/
Acknowledgments xxxv
About the Author xxxvii http://www.dropshippers.co.za/
- PART I--INTRODUCTION TO WINDOWS ADMINISTRATIVE SCRIPTING
1Chapter 1 Scripting Concepts and Terminology 3What Is Scripting? 3
Script Hosts 4 ActiveX Scripting Languages 6 The Component Object
Model (COM) 9 Critical Scripting Security Issues 9 Review 10Chapter
2 Running Scripts 11Windows Script Host 11 Command-Line Scripts 13
Notepad and Script Editors 16 Bare Bones: Notepad 16 A Step Up:
Programmer's File Editor 17 Script-Specific: VBScript Editors 18
Writing Your First Script 23 Running Your First Script 25 Debugging
Your First Script 25 Review 26 Chapter 3 The Components of a Script
29A Typical VBScript 29 Functions 32 Subroutines 33 Main Script 34
Using Custom Functions and Subroutines 36 Using Intrinsic Functions
and Statements 38 Making Decisions in a Script 40 Comments and
Documentation 40 Review 45Chapter 4 Designing a Script 47Creating a
Task List 48 Selecting the Appropriate Tools 50 Displaying a
Message 51 Mapping a Drive 53 Checking Group Membership 54 Mapping
a Printer 54 Getting the Local IP Address 54 Getting the Third
Octet from the IP Address 56 All Tasks Accounted For 56 Creating
Modules to Perform Tasks 57 Validating User Input 63 Planning for
Errors 63 Creating Script Libraries 66 Review 66PART II--VBSCRIPT
TUTORIAL 69Chapter 5 Functions, Objects, Variables, and More 71What
Are Variables? 72 Declaring Variables 76 Understanding Data Types
78 Assigning Data to Variables 79 Data Coercion 80 What Are
Functions? 82 Input Parameters 82 Output Values 84 Intrinsic versus
Custom Functions 85 What Are Statements and Subroutines? 89
Functions, without the Output 89 What Are Objects? 92 Properties 92
Methods 93 Collections 93 A Sample Object 94 Scripting with Objects
95 Review 97Chapter 6 Input and Output 99Displaying Messages 99 The
MsgBox Statement and Function 100 More Complex Messages 104 MsgBox
Best Practices 105 Go Generic with WScript.Echo 106 Asking for
Input 107 Graphical Input 107 Command-Line Input 109 Command-Line
Parameters as Input 110 Running Command-Line Scripts 110 Parsing
Parameters 110 Review 114Chapter 7 Manipulating Numbers 117Numbers
in VBScript 117 Basic Arithmetic 118 Advanced Arithmetic 121
Boolean Math 124 Converting Numeric Data Types 129 Converting Other
Data Types to Numeric Data 130 Review 130Chapter 8 Manipulating
Strings 133Strings in VBScript 133 Working with Substrings 135
Concatenating Strings 139 Changing Strings 141 Formatting Strings
143 Converting Other Data Types to String Data 144 Review
145Chapter 9 Manipulating Other Types of Data 147Working with Dates
and Times 147 Dates and Times in VBScript 148 Getting the Date or
Time 148 Converting Date and Time Data 149 Working with Past and
Future Dates 150 Working with Arrays 150 Arrays in VBScript 151
Creating and Manipulating Arrays 152 Working with Array Data 154
Working with Bytes 155 Bytes in VBScript 155 Converting Byte Data
156 Review 156Chapter 10 Controlling the Flow of Execution
157Conditional Execution 158 If...Then 158 Select...Case 163 Loops
164 Do While...Loop and Do...Loop While 164 Do Until...Loop and
Do...Loop Until 166 For...Next 166 For Each...Next 167 Exiting
Loops 169 Putting It All Together 170 Review 173Chapter 11 Built-in
Scripting Objects 175The WScript Object 175 The Network Object 176
Overview 177 Methods and Properties 177 Practical Application 182
The Shell Object 183 Overview 183 Methods and Properties 183 The
Shortcut Object 190 Methods and Properties 190 Practical
Application 191 Review 192Chapter 12 Working with the File System
193The FileSystemObject Library 193 Working with Drives 194 Working
with Drive Objects 195 Working with Folders 197 Working with Folder
Objects 198 Folder Attributes 200 Properties That Are Objects 203
Working with Files 204 Working with File Objects 204 Reading and
Writing Text Files 207 Other FSO Methods and Properties 211
Creating a Log File Scanner 212 Review 221Chapter 13 Putting It All
Together: Your First Script 223Designing the Script 224 Gathering
Facts 224 Defining Tasks 225 Outlining the Script 226 Writing
Functions and Subroutines 227 Identifying Candidate Modules 227
Writing the Filename Formatting Function 227 Writing the Main
Script 232 Identifying Potential Errors 237 Testing the Script 240
Analyzing the Results 242 Adding Debug Code 243 Modifying the
Script 246 Completing the Script 248 Review 251PART III--WINDOWS
MANAGEMENT INSTRUMENTATION AND ACTIVE DIRECTORY SERVICES INTERFACE
253Chapter 14 Working with ADSI Providers 255Using ADSI Objects 255
Using the WinNT Provider 257 Examples 259 Using the LDAP Provider
260 Other Providers 263 Review 263Chapter 15 Manipulating Domains
265Querying Domain Information 265 Changing Domain Settings 267
Working with OUs 268 Creating an OU 268 Modifying an OU 270
Querying an OU 272 Deleting an OU 272 Putting It All Together 273
Review 279Chapter 16 Manipulating Users and Groups 281Creating
Users and Groups 281 The WinNT Way 282 The LDAP Way 283 Querying
User Information 284 Changing User Settings 285 Working with Groups
286 Putting It All Together 288 Review 292Chapter 17 Understanding
WMI 293The WMI Hierarchy 293 Providers and Consumers 295 WMI
Versions 296 Exploring WMI's Capabilities 296 WQL Queries 300
Installing WMI 301 Using the WMI Tools 302 Scriptomatic 304
Really--It's This Easy 304 Find the Class 304 Write the Query, Test
the Query 306 Write the Script 307 Try the Script 309 Review
309Chapter 18 Querying Basic WMI Information 311The WMI Query
Language (WQL) 311 The Basics 313 Boolean Operators 314 Comparison
Operators 314 Associators, References, and Keys 316 Determining
What to Query 316 Testing the Query 319 Writing the Query in
VBScript 321 Using the Query Results 326 Alternative Methods 328
Review 329Chapter 19 Querying Complex WMI Information
331Understanding WMI Relationships 331 Associating WMI Instances
336 ASSOCIATORS OF 336 REFERENCES OF 338 Using WHERE with
ASSOCIATIONS OF and REFERENCES OF 339 Writing the Query 340 Testing
the Query 341 Writing the Query in VBScript 341 Another Example 345
Review 349Chapter 20 Putting It All Together: Your First WMI/ADSI
Script 351Designing the Script 351 Writing Functions and
Subroutines 357 Writing the Main Script 360 Testing the Script 369
Review 374PART IV--CREATING ADMINISTRATIVE WEB PAGES 375Chapter 21
Active Server Pages Crash Course 377About ASP 378 VBScript in ASP
379 The Response Object 381 Writing Output 382 Saving Cookies 382
Ending 384 The Request Object 384 HTML Forms 384 Cookies 385 A
Sample ASP Script 385 Testing ASP Scripts 389 Review 391Chapter 22
Adding Administrative Script to a Web Page 393The Basic Web Page
393 Adding Functions and Subroutines 396 Adding Inline Script 397
The Result 403 Review 417Chapter 23 Web Page Security Overview
419The ASP Security Context 419 Prohibited Behaviors 423 IIS 4.0,
5.0, and 5.1 versus IIS 6.0 424 NTFS and IIS Security 427 Writing
Secure ASP Code 427 Review 431Chapter 24 Putting It All Together:
Your First Administrative Web Pages 433Checking User Account Status
433 Designing the Page 434 Writing Functions and Subroutines 435
Writing the Main Script 437 Testing the Page 442 Administering IIS
443 Designing the Page 443 Writing Functions and Subroutines 444
Writing the Main Script 449 Review 460PART V--ADVANCED SCRIPTING
TECHNIQUES 461Chapter 25 Modular Script Programming 463Introduction
to Windows Script Components 463 Scripting and XML 465 Review
474Chapter 26 Using Script Components 475Obtaining the Component
475 Reviewing the Component 476 Using the Component 477 Review
479Chapter 27 Encoded Scripts 481Installing the Script Encoder 482
Writing Encoded Scripts 482 Running Encoded Scripts 485 Review
486Chapter 28 Scripting Security 487Why Scripting Can Be Dangerous
487 Security Improvements in Windows XP and Windows Server 2003 488
Digitally Signing Scripts 490 Running Only Signed Scripts 493 Ways
to Implement Safe Scripting 494 The Filename Extension Game 494
Script Signing 494 Antivirus Software 494 Defunct Techniques 495
Review 495PART VI--READY-TO-RUN EXAMPLES 497Chapter 29 Logon and
Logoff Scripts 499NT and Active Directory Logon Scripts 500 Active
Directory-Specific Logon Scripts 507 Active Directory Logoff
Scripts 513 Review 516Chapter 30 Windows and Domain Administration
Scripts 517Automating User Creation 517 Finding Inactive Users 527
Collecting System Information 533 Review 539Chapter 31 Network
Administration Scripts 541Shutting Down Remote Computers 541
Listing Remote Shares 544 Finding Out Who Has a File Open 547
Uninstall Remote MSI Packages 549 Adding Users from Excel 553
Listing Hot Fixes and Software 562 Review 566Chapter 32 WMI and
ADSI Scripts 567The All-Purpose WMI Query Script 567 The
All-Purpose WMI Update Script 569 The All-Purpose ADSI Object
Creation Script 571 The All-Purpose ADSI Object Query Script 572
The All-Purpose ADSI Object Deletion Script 573 Mass Password
Changes with ADSI 574 Review 576PART VII--APPENDIX 577Appendix
Administrator's Quick Script Reference 579
- Index 591
http://www.dropshippers.co.za/
Managing Windows® with VBScript and WMI descriptions were created by Managing Windows® with VBScript and WMI wholesale priced dropshippers.