You are previewing Advanced VBScript for Microsoft® Windows® Administrators.
O'Reilly logo
Advanced VBScript for Microsoft® Windows® Administrators

Book Description

Get the in-depth guidance you need to take your Windows scripting skills to the next level. Enterprise-level Windows administrators who have experience with Windows scripting will learn advanced VBScript techniques, including Active Directory® Service Interfaces (ADSI) and Windows Management Instrumentation (WMI) scripting, security scripting, building hypertext applications for script graphical interfaces, remote scripting, database scripting, and scripting for Group Policy. You will continue to build your skills by creating scripts to work with Microsoft Exchange Server, Microsoft SQL Server™, Microsoft Operations Manager, and Microsoft Virtual Server. Coverage also includes the latest scripting updates for Windows XP and Windows Server™ 2003. Each chapter highlights powerful, ready-to-run, enterprise-level scripts, and the companion CD-ROM includes sample scripts and utilities to help you put your advanced scripting skills to work right away.

Table of Contents

  1. Advanced VBScript for Microsoft® Windows® Administrators
  2. A Note Regarding Supplemental Files
  3. Acknowledgements
  4. Introduction
    1. Who Is This Book For?
    2. Conventions in This Book
    3. System Requirements
    4. About the Companion CD
    5. Support for This Book
  5. I. The Basics of Advanced Windows Scripting
    1. 1. Getting Started
      1. Prerequisite Knowledge
        1. Understanding Windows Script Host Basics
          1. WshShell
            1. Popup
            2. Registry Reading
            3. Program Launching
          2. WshNetwork
          3. Error Handling
          4. InputBox
          5. MsgBox
        2. Using the FileSystemObject Library
        3. Understanding Arrays
        4. Understanding Active Directory Services Interface Fundamentals
        5. Understanding Windows Management Instrumentation Fundamentals
          1. Winmgmts
          2. WMI Query Language (WQL)
          3. SWbemLocator
      2. Advanced Scripting Goals
        1. Securing Your Scripts
        2. Creating Your Own Script Components and Libraries
        3. Running Scripts Remotely
        4. Retrieving Information from Active Directory
        5. Manipulating Information Stored in a Database
        6. Managing Your Windows Environment with WMI Events
        7. Using New WMI Classes with Windows XP and Windows Server 2003
        8. Managing Group Policy Objects with Scripting
        9. Managing Your Exchange 2003 Environment
        10. Incorporating Your Scripts into Microsoft Operations Manager
        11. Creating a Visual Interface for Your Script with Internet Explorer and HTML Applications (HTAs)
      3. What We Won’t Cover
        1. Finding Information about JScript, Perl, Python, and KiXtart
      4. The Right Tool for the Job
      5. Scripting Techniques
      6. Summary
    2. 2. Script Security
      1. Script Encoding and Decoding
      2. Script Signing and the Windows Script Host TrustPolicy
        1. Understanding Digital Certificates and Script Signing
        2. Understanding WSH TrustPolicy
        3. Configuring WSH TrustPolicy in Your Environment
        4. Signing Scripts by Using a Digital Certificate
        5. Using Software Restriction Policies
      3. Alternate Credentials
        1. Using the RunAs Command
        2. Using Scheduled Tasks Credentials
        3. Using ADSI Alternate Credentials
        4. Using WMI Alternate Credentials
      4. Summary
  6. II. Packaging Your Scripts
    1. 3. Windows Script Files
      1. Defining Windows Script Files
      2. Understanding XML
        1. The package Tag
        2. The comment Tag
        3. The job Tag
        4. The runtime Tag
        5. The description Tag
        6. The example Tag
        7. The named Tag
        8. The object Tag
        9. The script Tag
      3. Creating Script Jobs
      4. Including Other Scripts
      5. Adding Resources
      6. Creating Examples and Help Text
      7. Using Named Parameters
        1. The name Property
        2. The helpstring Property
        3. The type Property
        4. The required Property
      8. Viewing a Windows Script File in Action
      9. Converting an Existing Script to a WSF Utility
      10. Creating and Using a Wrapper WSF
      11. Summary
    2. 4. Windows Script Components
      1. Understanding COM Objects, Methods, and Properties
      2. Understanding Windows Script Components
      3. Using the Script Component Wizard
      4. Working with Properties
      5. Working with Methods
      6. Working with Events
      7. Creating a Windows Script Component with a Script Editor
      8. Viewing a Windows Script Component in Action
      9. Summary
    3. 5. HTML Applications: Scripts with a User Interface
      1. Understanding HTML Applications
      2. Understanding the Internet Explorer Document Object Model
        1. Understanding the HTML Document Hierarchy
        2. Understanding HTML Events
        3. Putting the DOM to Work
      3. Preparing Your HTA
        1. Using a Script Rather than an HTA
        2. Getting the Script Ready for an HTA
      4. Understanding HTA Requirements and Essentials
        1. Using HTA Tags
        2. Sizing an HTA
        3. Using <div> and <span> Tags
        4. Using Inline Frames
      5. Working with Forms and Fields
        1. Populating a List Box
        2. Creating Buttons
        3. Connecting a Button to a Script
        4. Using Check Boxes and Radio Buttons
        5. Adding Graphics
      6. Adding Subroutines and Functions
      7. Viewing HTAs in Action
      8. Summary
  7. III. Advanced Scripting Techniques, Tools, and Technologies
    1. 6. Remote Scripting
      1. Understanding Remote Scripting and Security
        1. Connectivity
        2. Identity
        3. Permissions
        4. Context
      2. Working with Windows Firewall
      3. Understanding Remote Scripting Objects
      4. Understanding Remote Scripting Methods
      5. Viewing Remote Scripting in Action
      6. Summary
    2. 7. Database Scripting
      1. Understanding ActiveX Data Objects
      2. Understanding Connection Objects
        1. ODBC DSN Connections
        2. Connection Strings
      3. Understanding Recordset Objects
        1. Forward-Only Recordsets
        2. Other Types of Recordsets
        3. Recordset Tips and Tricks
      4. Understanding Command Objects
      5. Understanding the Differences Between Databases
        1. Text Files
        2. Excel Workbooks
        3. Access Databases
        4. SQL Server Databases
      6. Understanding SQL
        1. Queries that Return Results
          1. The WHERE Clause
          2. The TOP Clause
          3. The ORDER BY Clause
          4. The JOIN Clause
        2. Queries that Make Changes
          1. The DELETE Query
          2. The UPDATE Query
          3. The INSERT Query
      7. Viewing ActiveX Data Objects
      8. Summary
    3. 8. Advanced ADSI and LDAP Scripting
      1. Using the ADSI Scriptomatic
        1. Connecting to a Domain
        2. Creating Objects
        3. Retrieving Object Information
      2. Using Other ADSI Tools
        1. Using the ADSI Software Development Kit
          1. ADSVW
          2. ADSCmd
          3. ADSIDump
        2. Using the PrimalScript Professional ADSI Wizard
      3. Writing Active Directory Queries
        1. Using Search Filters
        2. Using Data Return Limits
      4. Scripting the WinNT Provider
      5. Scripting Active Directory Security
      6. Summary
    4. 9. Using ADO and ADSI Together
      1. Understanding the ADSI Provider for ADO
      2. Connecting to ADSI by Using ADO
      3. Treating Active Directory as a Database
      4. Writing ADSI Queries to Retrieve Information
      5. Writing ADSI Queries to Make Changes
      6. Viewing ADO and ADSI in Action
      7. Summary
    5. 10. Advanced WMI Scripting
      1. Understanding Advanced WQL
        1. Selecting Specific Properties
        2. Including a WHERE Clause
        3. Using the LIKE Operator
      2. Using Queries and associator Classes
        1. Understanding Associations
        2. Writing Association Queries
        3. Using References Queries
      3. Using Advanced WMI Security Techniques
        1. Using the AuthenticationLevel Property
        2. Using the ImpersonationLevel Property
        3. Using the Privileges Property
      4. Viewing Advanced WMI Scripting in Action
      5. Summary
    6. 11. WMI Events
      1. Understanding WMI Events
        1. Understanding Consumers
        2. Understanding Notification Queries
        3. Understanding Filters
        4. Understanding Polling
      2. Using Notification Queries
        1. Using WBEMTest
        2. Executing a Notification Query Semisynchronously
        3. Executing a Notification Query Asynchronously
        4. Using Event Sinks
      3. Using WMI Tools
        1. Using WMI Event Registration
        2. Using WMI Event Viewer
      4. Viewing WMI Events in Action
      5. Summary
    7. 12. Better Scripting with WMI Tools
      1. Using Tools as a Scripting Shortcut
      2. Using Scriptomatic
        1. Listing Classes and Namespaces
        2. Generating Scripts
        3. Saving Scripts
      3. Using WMIC
        1. Connecting to Namespaces
        2. Using Aliases
        3. Connecting to Remote Systems
        4. Passing Credentials
        5. Making Queries with list and get
        6. Formatting Output
          1. Saving Output to the Command Prompt Window
          2. Saving Output to the Clipboard
          3. Saving Output to a File
          4. Using XSL Files
          5. Creating Your Own XSL File
        7. Scripting with WMIC
      4. Using WBEMTest
        1. Connecting to a Namespace
          1. Enabling Privileges
          2. Enabling Impersonation
          3. Enabling Authentication
          4. Enabling Authority
        2. Enumerating Instances
      5. Using WMI Tools
        1. Using CIM Studio
          1. Connecting to a Namespace
          2. Connecting to Remote Computers
          3. Using Alternate Credentials
          4. Searching for Classes
          5. Returning Instances
          6. Running Queries
        2. Using WMI Object Browser
      6. Comparing WMI Wizards
      7. Summary
    8. 13. Advanced Scripting in Windows XP and Windows Server 2003
      1. Using New and Discontinued WMI Classes
      2. Using the Win32_PingStatus Class
      3. Configuring the Windows Firewall
      4. Using Disk Quota Management
      5. Using the DNS Provider
      6. Using Active Directory Replication and Trusts
      7. Using Internet Information Services 6.0
      8. Managing Printing
      9. Using Windows Update Services
      10. Summary
  8. IV. Scripting for the Enterprise
    1. 14. Group Policy Management Scripting
      1. Introducing Group Policy Management Scripting
        1. Group Policy Management Scripting Requirements
        2. Group Policy Management Console Object Model
          1. Constants
          2. Scope of Management
      2. Scripting GPO Permissions
      3. Scripting GPO Reports
      4. Scripting GPO Backups
      5. Scripting GPO Restores
      6. Scripting Resultant Set of Policy
      7. Viewing GPO Scripting in Action
      8. Summary
    2. 15. Exchange 2003 Scripting
      1. Introducing Exchange Scripting
      2. Querying Active Directory
      3. Understanding Exchange 2003 WMI Classes
      4. Scripting the Exchange Server State Class
      5. Scripting Exchange Storage Groups
      6. Scripting Exchange Mailboxes
      7. Viewing Exchange Server Scripting in Action
      8. Summary
    3. 16. Microsoft Operations Manager 2005 Scripting
      1. Introducing MOM Scripting
        1. Adding Scripts
        2. Defining Script Parameters
        3. Using Run Time Scripting Objects
          1. Using the PerfData Object
          2. Using the Alert Object
          3. Using the Event Object
        4. Understanding Script Tracing and Debugging
      2. Using Scripts in MOM
        1. Using Response Scripts
        2. Using Timed Scripts
        3. Using State Variable Scripts
        4. Using Discovery Scripts
      3. Customizing MOM Scripts
      4. Viewing MOM Scripting in Action
      5. Summary
    4. 17. Virtual Server 2005 Scripting
      1. Introducing Virtual Server Scripting
      2. Understanding the Virtual Server Object Model
      3. Writing Provisioning Scripts
      4. Writing Management Scripts
        1. Obtaining Object References
        2. Managing Multiple-Virtual-Machine Templates
        3. Performing Virtual Machine Tasks
        4. Performing Virtual Disk Tasks
        5. Performing Guest OS Tasks
        6. Performing Mouse and Keyboard Tasks
      5. Viewing Virtual Server Scripting in Action
      6. Summary
  9. V. Appendix
    1. A. Advanced Script Editor Features
      1. Universal Features
      2. Keyboard Shortcuts
      3. Script Snippets
      4. Code Hinting and Completion
      5. Wizards
      6. Debugging
      7. Enterprise Features
      8. Security Features
      9. Script Deployment and Remote Scripting
      10. WSF and WSC Support
      11. Other Features
      12. Where to Get the Software
  10. About the Authors
  11. Inside Front Cover
    1. Additional Windows (R2) Resources for Administrators
    2. Additional SQL Server Resources for Administrators
  12. Index
  13. About the Authors
  14. Copyright