Windows® XP Under the Hood

Book description

Get ready to roll up those shirtsleeves, pop the hood, and get a little Windows grime under those fingernails! This is a book about tools, nuts and bolts. Through lucid tutorials and examples, Windows XP Under the Hood shows how to use scripting and batch tools to automate repetitive tasks. You'll master the gory details of the automation, management, command-line and diagnostic tools that are often given short shrift in both online documentation and standard end-user books. Then, the detailed reference sections will keep you coming back time and again. This book will help you make the leap from accomplished user to bona fide Windows hero.

  • Finally, a hardcore Windows book that digs into the XP interface while not putting the reader to sleep! Lively and written for Windows mechanics who live for more power.

  • Learn how to create and deploy tools to manage your computers and networks. Here you'll find a straightforward introduction to scripting with VBScript, coverage of dozens of powerful programming and management objects, and from-the-trenches advice on distributing and managing your new toolkit.

  • Learn how to master the Command Line. Many books cover Windows Script Host, but none of the others address the powerful and still-useful batch file language and command-line utilities.

  • Clear, practical examples show how each scripting object, batch file or command line utility can change lives, make the dog behave, and eliminate bad hair days.

  • Although Microsoft provides the tools, users are hard pressed to find much-if any-documentation on these tools. Rather than learning by osmosis, we suggest that you pick up a copy of this indispensable book.

  • Table of contents

    1. Copyright
      1. Dedication
    2. About the Author
    3. Acknowledgments
    4. Tell Us What You Think
    5. Introduction
      1. Why Learn About This Stuff?
      2. How This Book Is Organized
      3. Conventions Used in This Book
        1. Text Conventions
        2. Special Elements
          1. Cross-References
    6. I. Scripting
      1. 1. Introduction to Windows Script Host
        1. What Is a Windows Script?
          1. The “Windows Script” Part
          2. The “Host” Part
          3. How Is This Different from Writing Batch Files?
        2. Scripting Languages
          1. VBScript
          2. JScript
          3. Perl
          4. Python
          5. Object REXX
          6. Ruby
          7. Choosing a Language
        3. A Simple Script
        4. Script Files
          1. JSE and VBE: Encoded Scripts
          2. WSF: Windows Script Files
          3. WSC: Windows Script Components
          4. WSH: Windows Script Host Settings
        5. Running Scripts
          1. Wscript and Cscript
          2. Ways to Run a Script
          3. Passing Information to Scripts
          4. Saving the Results from Scripts
          5. Wscript and Cscript Command Options
          6. Using Scripts
            1. Making a Script Shortcut
            2. Scheduling Scripts
            3. Scripts Run from Batch Files
          7. Logon and Logoff Scripts
          8. Logoff Scripts?
        6. Security Concerns
          1. Trust Policy and Script Signing
        7. Debugging Scripts
          1. Viewing and Altering Variables
          2. Viewing the Call Stack
        8. Where to Get More Information
      2. 2. VBScript Tutorial
        1. Introduction to VBScript
          1. Variables
          2. Constants
          3. Named Constants
          4. Operators and Expressions
          5. Automatic Conversion
        2. Flow Control
          1. The If...Then Statement
          2. The Select Case Statement
          3. The Do While Loop
          4. Terminating a Loop with Exit Do
          5. Counting with the For...Next Statement
          6. Processing Collections and Arrays with For...Each
        3. VBScript Functions
          1. Calling Functions and Subroutines
          2. Documentation and Syntax
          3. String-Manipulation Functions
            1. Searching for Strings with InStr() and InStrRev()
            2. Extracting Parts of Strings with Left(), Right(), and Mid()
            3. Other String Operations
          4. Date and Time Functions
            1. Reading the Clock with Date(), Time(), and Now()
            2. Computing a Future Date with DateAdd
            3. The DateDiff() Function
            4. Other Date Functions
        4. Interacting with the User
          1. The MsgBox() Function
          2. The InputBox() Function
          3. Printing Simple Text Messages with Wscript.Echo
            1. A Touchy Subject
        5. Advanced VBScript Topics
          1. Procedures: Functions and Subroutines
            1. Functions
            2. Subroutines
          2. Arrays
          3. Variable Scope
        6. Where to Go from Here
      3. 3. Scripting and Objects
        1. Introduction to Objects
          1. Classes and Instances
          2. Containers and Collections
          3. Object Naming
        2. Using Objects with VBScript
          1. Automation and Document Files
          2. The Difference Between Properties and Methods
          3. Nested Objects
          4. Releasing Objects
          5. Working with Collections
        3. Using Objects with JScript
          1. Case Sensitivity
          2. Working with Collections
        4. Using Objects with ActivePerl
          1. Running Perl Scripts in WSH
          2. The Perl Object Interface
          3. Working with Collections
        5. Using Objects with ActivePython
          1. Working with Collections
        6. Using Objects with Object REXX
          1. Creating Object REXX Files
          2. Working with Collections
        7. Using the WScript Object
          1. Retrieving Command-Line Arguments
        8. Locating and Using Unusual Objects
      4. 4. File and Registry Access
        1. Getting Real Work Done
        2. Manipulating Files and Folders
          1. Scripting.FileSystemObject
          2. Working with File and Path Names
            1. Deleting and Renaming Files
            2. Creating a Folder
            3. Copying a Folder
          3. The Scripting.Drive Object
            1. Confirming That a Drive Exists
            2. Finding a Drive with the Most Free Space
          4. The Scripting.Folder Object
            1. File and Folder Attribute Values
            2. Testing File and Folder Attribute Values
            3. Testing Multiple Attributes
            4. Changing File and Folder Attributes
          5. The Scripting.File Object
            1. Renaming a File
            2. Scanning for Files Based on Name, Type, Size, and So On
        3. Reading and Writing Files
          1. The TextStream Object
          2. Reading Text from Files
          3. Writing Text to Files
            1. Constructing More Complex Text Files
            2. Writing Unix-Compatible Text Files
          4. Working with Stdin and Stdout
            1. Prompting for User Input
          5. Reading Binary Files
            1. Example: Reading BMP Image Data
            2. Example: Reading MP3 Tag Data
        4. Reading and Writing XML and HTML
          1. Some XML Basics
          2. Reading an XML or HTML File
          3. Creating an XML or HTML File
        5. Manipulating Programs and Shortcuts
          1. The WScript.Shell Object
          2. Running Programs
            1. Running Windows Programs
            2. Running Command-Line Programs
          3. Creating and Modifying Shortcuts
        6. Working with the Environment
          1. Extracting Environment Information
          2. Managing Environment Settings
        7. Working with the Registry
          1. Examining Registry Keys and Values
          2. Saving Information in the Registry
      5. 5. Network and Printer Objects
        1. Managing Network and Printer Connections
        2. Displaying Network User Information
        3. Managing Drive Mappings
          1. Listing Drive Mappings with EnumNetworkDrives
          2. Adding Drive Mappings
          3. Deleting Drive Mappings
          4. Setting Up Mappings in a Script
        4. Managing Network Printer Connections
          1. Displaying Printer Information
          2. Connecting to Network Printers
          3. Redirecting DOS Session Printers
          4. Deleting Printer Connections
          5. Setting the Default Printer
        5. Printing from Scripts
      6. 6. Messaging Objects
        1. Sending E-mail from Scripts with CDO
        2. The CDO Object Model
          1. The CDO.Message Object
          2. Working with Fields
          3. Fields for the CDO.Message Object
          4. The CDO BodyParts Collection
          5. The CDO BodyPart Object
          6. The ADO Stream Object
          7. The CDO.Configuration Object
        3. Sending a Message with CDO
          1. Constructing the Message
            1. Sending a Text String
            2. Sending a Message from a Text File
            3. Sending the Output of a Program
            4. Sending an HTML Message
            5. Sending a Web Page or HTML File
            6. Sending a Multiformat Message
          2. Adding Attachments
          3. Specifying the Recipients and Subject
          4. Specifying the Delivery Server
            1. Using an SMTP Server
            2. Using the SMTP Service Provided with IIS
          5. Sending the Message
          6. Putting It All Together
      7. 7. Windows Management Instrumentation (WMI)
        1. Introduction to Windows Management Instrumentation
          1. Functions of the WMI
          2. Namespaces
        2. Enabling WMI on Your Network's Computers
          1. Windows NT, 2000, and XP
          2. Windows 95, 98, and Me
        3. Making WMI Connections
          1. WMI Object Hierarchy
          2. Connecting with the WbemScripting.SWbemLocator Object
          3. Connecting with a Moniker
          4. Connecting to the Local Computer
          5. Security and Authentication
            1. Authentication and Encryption
            2. Impersonation
            3. Privileges
          6. Specifying Security Options
            1. Specifying Security Options with the SWbemServices Object
            2. Specifying Security Options in Monikers
        4. WMI Collections and Queries
          1. SWbemServices
          2. WQL Queries
          3. SWbemObjectSet
          4. SWbemObject
          5. SWbemMethodSet and SWbemPropertySet
        5. WMI Applications
          1. Collecting System Information
          2. Managing Printers
          3. Monitoring Windows Service Packs and Hotfixes
          4. Managing Services and Tasks
        6. For More Information
      8. 8. Active Directory Scripting Interface (ADSI)
        1. Managing the User Directory
          1. Uses of the Active Directory Scripting Interface
          2. Limitations of ADSI with Windows Script Host
        2. ADSI Concepts
          1. Multiple Inheritance
          2. Creating ADSI Objects
          3. Directory Security
          4. Determining the Difference Between Containers and Leaves
        3. ADSI Objects for the WinNT: Provider
          1. Important Notes Regarding the Microsoft Documentation
          2. IADs
          3. IADsCollection and IADsContainer
          4. Working with ADSI Collections
          5. IADsComputer and IADsComputerOperations
          6. IADsDomain
          7. IADsFileService and IADsFileServiceOperations
          8. IADsFileShare
          9. IADsGroup
          10. IADsMembers
          11. IADsNamespaces
          12. IADsPrintJob and IADsPrintJobOperations
          13. IADsPrintQueue and IADsPrintQueueOperations
          14. IADsService and IADsServiceOperations
          15. IADsSession
          16. IADsUser
        4. IIS and Exchange
        5. Managing Active Directory
          1. X.500 and LDAP Terminology
        6. Active Directory Objects
          1. RootDSE
          2. IADsO and IADsOU
        7. Developing ADSI Scripts
        8. For More Information
      9. 9. Creating Your Own Scriptable Objects
        1. Why Create Your Own Objects?
        2. Programming Language Options
          1. VBScript and JScript
          2. Visual Basic
          3. C and C++
        3. Creating Objects with WSC Files
          1. WSC File Format
          2. XML Basics
          3. Understanding the Example
        4. WSC File Format Reference
        5. Creating a WSC Component
          1. Using the Windows Script Component Wizard
          2. Defining Properties and Methods
            1. Binding a Property to a Variable
            2. Implementing a Property with Functions
            3. Defining Methods
          3. Using Other Objects and Type Libraries
          4. Defining Resources
          5. Registering the Component
          6. Testing
          7. Using Scripted Objects from Other Programs
          8. Deploying the Object to Other Computers
        6. Creating a Practical Object
      10. 10. Deploying Scripts for Computer and Network Management
        1. Using Scripts in the Real World
          1. Designing Scripts for Other Users
        2. Using WSF Files
          1. WSF File Format Reference
          2. Enclosing More Than One Script
          3. Providing Online Help with WSF Files
          4. Processing Command-Line Arguments
            1. Processing Named Arguments (Switches)
            2. Processing Unnamed Arguments
          5. Putting It All Together
        3. Deploying Scripts on a Network
        4. Creating Simple Installation Programs with IExpress
          1. Creating INF files
        5. Writing Scripts to Manage Other Computers
          1. Remote Scripting
            1. Enabling Remote Scripting
            2. Writing and Running Remote Scripts
          2. Replicating Scripts to Multiple Computers
        6. Scripting Security Issues
          1. Script Signing
          2. The Script Encoder
        7. Setting Up Logon Scripts
          1. User Profile Logon Scripts
          2. Group Policy Logon, Logoff, Startup, and Shutdown Scripts
        8. Scheduling Scripts to Run Automatically
          1. Writing Unattended Scripts
            1. Controlling the Amount of Information Logged
          2. Sending Messages to the Event Log
            1. Printing and Messaging
            2. Summarizing Results
          3. Scheduling Scripts with the Task Scheduler
    7. II. The Command-Line Environment
      1. 11. The CMD Command-Line Environment
        1. The Command Prompt
          1. CMD Versus COMMAND
        2. Command-Line Processing
          1. Stopping Runaway Programs
          2. Console Program Input and Output
          3. Using the Console Window
          4. I/O Redirection and Pipes
          5. Copy and Paste in Command Prompt Windows
          6. Command Editing and the History List
          7. Name Completion
          8. Multiple Commands on One Line
          9. Grouping Commands with Parentheses
          10. Arguments, Commas, and Quotes
          11. Escaping Special Characters
        3. Configuring the CMD Program
          1. AutoRun
          2. Environment Variable Substitution
          3. The Search Path
          4. Changing the Path
          5. The Adjustable Prompt
          6. Predefined and Virtual Environment Variables
          7. Setting Default Environment Variables
        4. Built-In Commands
          1. Extended Commands
          2. Listing Files with the Dir Command
            1. Paginating Long Listings
            2. Searching for Particular Files
            3. Making Columnar Listings
            4. Printing Directory Listings
            5. Getting Lists of Filenames
            6. Sorting Listings
            7. Listing Hidden Files
          3. Setting Variables with the Set Command
            1. Performing Numerical Calculations in Batch Files
          4. Conditional Processing with the If Command
          5. Scanning for Files with the For Command
            1. Using the for Command's Variable
            2. Processing Directories
            3. Processing Files in Directories and Subdirectories
            4. Numerical for Loop
            5. Parsing Text
        5. Running CMD
          1. Disabling Command Extensions
          2. Enabling Directory Name Completion
        6. Getting More Information
      2. 12. Batch Files for Fun and Profit
        1. Why Batch Files?
        2. Creating and Using Batch Files
        3. Batch File Programming
        4. Displaying Information in Batch Files
        5. Argument Substitution
        6. Argument Editing
        7. Conditional Processing with If
          1. The Basic If Command
          2. Checking for Files and Folders
          3. Checking the Success of a Program
          4. Performing Several Commands After If
          5. Extended Testing
        8. Processing Multiple Arguments
        9. Working with Environment Variables
          1. Environment Variable Editing
        10. Processing Multiple Items with the For Command
          1. Using Multiple Commands in a For Loop
          2. Delayed Expansion
        11. Using Batch File Subroutines
        12. Prompting for Input
        13. Useful Batch File Techniques
          1. Processing Command-Line Options
          2. Managing Network Mappings
            1. Use UNC Pathnames
            2. Use Pushd to Assign a Random Drive Letter
            3. Delete Previous Mappings Before Starting
          3. Checking for Correct Arguments
          4. Keeping Log Files
      3. 13. The MS-DOS Environment Under Windows XP
        1. MS-DOS Programs on Windows XP
          1. The Virtual DOS Machine
            1. forcedos
          2. MS-DOS and COMMAND.COM
        2. Configuring the MS-DOS Environment
          1. Window and Memory Options
            1. Program Settings
            2. Font Settings
            3. Memory Settings
            4. Screen Settings
            5. Miscellaneous Settings
            6. Compatibility Settings
          2. CONFIG.NT
          3. AUTOEXEC.NT
          4. MS-DOS Environment Variables
        3. MS-DOS and Networking
          1. MS-DOS and Novell Networking
        4. Printing from MS-DOS
          1. Print Redirection
          2. Print Screen
        5. Configuring Serial Communications with MS-DOS
        6. Using Special-Purpose Devices for MS-DOS
        7. Managing MS-DOS Programs
          1. When Things Go Awry
      4. 14. Command-Line Programs
        1. Windows Command-Line Programs
        2. The Essential Command Line
        3. GUI Shortcuts
        4. General-Purpose Shell Programs
          1. findstr
          2. Case-Insensitive Searching
          3. Literal String Matching
          4. Positional Searching
          5. Searching Multiple Files
          6. Getting Extra Information
          7. Matching Text with Wildcards
            1. more
            2. tree
            3. xcopy
          8. Copying Subdirectories
          9. Making Backups
          10. Copying Only Updated Files
          11. Unattended Backups
        5. File-Management Tools
          1. attrib
          2. Finding Hidden Files
          3. Setting and Clearing Attributes
            1. cacls
          4. Checking Permissions
          5. Granting Permissions to Everyone
          6. Making a File or Folder Private
        6. Management Power Tools
          1. driverquery
          2. runas
          3. tasklist
          4. taskkill
          5. Killing a Process by PID Number
          6. Killing the Processes of Another User
          7. Killing Processes by Program Name
            1. sc
          8. Listing Installed Services
          9. Starting and Stopping Services
        7. Networking Utilities
          1. ipconfig
          2. Listing IP Address Information
          3. Resetting Automatically Assigned Addresses
          4. Examining and Clearing the DNS Cache
            1. net
              1. net continue
              2. net file
              3. net group
              4. net help
              5. net helpmsg
              6. net localgroup
              7. net pause
              8. net print
              9. net send
              10. net session
              11. net share
              12. net start
              13. net statistics
              14. net stop
              15. net time
              16. net use
              17. net user
              18. net view
            2. netstat
          5. Listing Active Connections
          6. Listing Open Ports (Servers)
          7. Listing Statistics
          8. Constant Monitoring
            1. nslookup
          9. Finding an IP Address Given a Hostname
          10. Finding the Hostname for an IP Address
          11. Examining Start of Authority Information
          12. Testing a DNS Server
            1. ping
            2. tracert
    8. III. Appendixes
      1. A. VBScript Reference
        1. VBScript 5.6 Language Features
        2. Syntax
        3. General Structure of a VBScript Program
        4. Data Types and Variables
          1. Note on Dates and Times
          2. Variable Scope
        5. Expressions and Operators
          1. Arithmetic Operators
          2. Comparison Operators
          3. Logical Operators
          4. Results of Mathematical Operations
        6. Program Statements
        7. Functions
          1. Date Function Intervals
        8. Predefined Constants
          1. Special Values
          2. Color Constants
          3. Comparison Constants
          4. Date and Time Constants
          5. Date Formatting Constants
          6. MsgBox Constants
          7. String Constants
          8. Tristate Settings
          9. Variable Type Constants
          10. Miscellaneous Constant
        9. VBA Features Omitted from VBScript
      2. B. Object Reference
        1. Collection and Dictionary Objects
        2. Script Management and Utility Objects
        3. File Access Objects
        4. XML/HTML Processing Objects
        5. Program Environment Objects
        6. Network and Printer Objects
        7. Messaging Objects
        8. Windows Management Interface (WMI) Objects
        9. Active Directory Scripting Interface (ADSI) Objects
      3. C. WSF and WSC File Format Reference
        1. XML Conformance
        2. Structure of a WSF Script File
        3. Structure of a WSC Component File
        4. Tag Syntax
      4. D. CMD and Batch File Language Reference
        1. The CMD Command Line
        2. Batch File Argument and for Variable Replacement
        3. Environment Variable Expansion
        4. Predefined Environment Variables
        5. Command Formatting
        6. Built-In Commands
          1. For Command Modifiers
          2. Set /A Expression Operators
      5. E. Windows XP Program Reference
        1. Accessibility Aids
        2. Administrative Tools
        3. Built-In and Batch File Commands
        4. DOS Commands
        5. File-Management Commands
        6. Handy Programs
        7. Networking Tools
        8. Server Management Tools
        9. Software Development Aids
        10. TCP/IP Utilities
        11. Windows GUI Programs
      6. F. Index of Patterns and Sample Programs
        1. Index of Patterns
        2. Index of Sample Scripts and Batch Files

    Product information

    • Title: Windows® XP Under the Hood
    • Author(s): Brian Knittel
    • Release date: July 2002
    • Publisher(s): Que
    • ISBN: None