You are previewing Monad (AKA PowerShell).
O'Reilly logo
Monad (AKA PowerShell)

Book Description

Windows PowerShell, formerly know by its codename "Monad" and available now for Windows Server 2003, Windows XP, and Windows Vista, and soon for Exchange Server 2007 and MOM, is the future of Windows administration. From setting up automated build environments to managing 20,000 Exchange email clients in an organization, any tool that reduces the number of repetitive steps an administrator must perform, is a real win. Even better, PowerShell part of a major Microsoft initiative that aims to replace a host of Windows management tools with a single, unified shell. This is the promise of PowerShell and the reason IT professionals need to start learning how to use it today

Reflecting the best of legacy tools such as bash and the Korn shell, PowerShell also breaks new ground in its command language design and its use of the object-oriented .NET Framework. And there is no better way to learn how to put PowerShell to work than to get your hands on Monad, O'Reilly's innovative, hands-on introduction to the tool. This concise 200-page book is an exciting tour of some of the new capabilities that PowerShell puts into the hands of system administrators and power users, and is the perfect complement to existing PowerShell documentation.

With more than 40 hands-on activities, the book covers every angle, from using PowerShell commands and its object-oriented pipelines to querying systems, generating reports and writing scripts that automate existing tasks. Adding to the lure is the fact that the book is written by Microsoft manager, Andy Oakley with a Foreword by PowerShell architect Jeffrey Snover-so you can be certain that it's teeming with inside information. Monad lets you see for yourself how PowerShell can significantly improve your productivity.

Because the PowerShell technology has wide appeal, so, too, does this compact guide. Developers, administrators, and power users alike can all benefit from its insight. If you're someone who habitually drifts toward the c-m-d keys, knows all of the switches to most command tools, or spends time authoring batch files to solve new challenges, this book is right up your alley. And if your organization plans to upgrade soon to Exchange 2007 or MOM V3, there's no time to waste.

Breaking News: A PowerShell RC1 Update to the book is now available at no charge from the book's catalog page on oreilly.com!

Table of Contents

  1. Monad (AKA PowerShell)
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. Foreword
    3. Preface
      1. Who This Book Is For
      2. How This Book Is Organized
      3. What You Need to Use This Book
      4. Conventions Used in This Book
      5. Using Code Examples
      6. How to Contact Us
      7. Safari® Enabled
      8. Acknowledgments
    4. 1. Introducing MSH
      1. 1.1. Get MSH
        1. 1.1.1. Downloading MSH
      2. 1.2. Get to Know Verb-Noun Syntax and Cmdlets
        1. 1.2.1. How Do I Do That?
          1. 1.2.1.1. Running a first command
        2. 1.2.2. What Just Happened?
          1. 1.2.2.1. What is a cmdlet?
          2. 1.2.2.2. Why the verb-noun model?
        3. 1.2.3. What About...
        4. 1.2.4. Where Can I Learn More?
      3. 1.3. Access the Registry Like a Filesystem
        1. 1.3.1. How Do I Do That?
        2. 1.3.2. What About...
        3. 1.3.3. Where Can I Learn More?
      4. 1.4. Create a Pipeline to Pass Information
        1. 1.4.1. How Do I Do That?
        2. 1.4.2. What Just Happened?
        3. 1.4.3. What About...
        4. 1.4.4. Where Can I Learn More?
      5. 1.5. Display Data
        1. 1.5.1. How Do I Do That?
        2. 1.5.2. What Just Happened?
        3. 1.5.3. What About...
        4. 1.5.4. Where Can I Learn More?
      6. 1.6. What's Next?
    5. 2. Customizing MSH
      1. 2.1. Load and Save Scripts
        1. 2.1.1. How Do I Do That?
        2. 2.1.2. What Just Happened?
        3. 2.1.3. What About...
        4. 2.1.4. Where Can I Learn More?
      2. 2.2. Save Keystrokes with Aliases
        1. 2.2.1. How Do I Do That?
        2. 2.2.2. What Just Happened?
        3. 2.2.3. What About...
        4. 2.2.4. Where Can I Learn More?
      3. 2.3. Work with the Command Line
        1. 2.3.1. How Do I Do That?
        2. 2.3.2. What About...
        3. 2.3.3. Where Can I Learn More?
      4. 2.4. Make Yourself at Home
        1. 2.4.1. How Do I Do That?
        2. 2.4.2. What Just Happened?
        3. 2.4.3. Where Can I Learn More?
      5. 2.5. Find Out What a Command Will Do Before Running It
        1. 2.5.1. How Do I Do That?
        2. 2.5.2. What Just Happened?
        3. 2.5.3. What About...
      6. 2.6. What's Next?
    6. 3. Scripting MSH
      1. 3.1. The .NET Framework
      2. 3.2. Work with Structured Objects
        1. 3.2.1. How Do I Do That?
        2. 3.2.2. What Just Happened?
        3. 3.2.3. What About...
        4. 3.2.4. Where Can I Learn More?
      3. 3.3. Store Information in Variables
        1. 3.3.1. How Do I Do That?
        2. 3.3.2. What Just Happened?
          1. 3.3.2.1. Working with arrays and hashtables
          2. 3.3.2.2. Special values
          3. 3.3.2.3. By-value assignment
          4. 3.3.2.4. By-reference assignment
        3. 3.3.3. What About...
        4. 3.3.4. Where Can I Learn More?
      4. 3.4. Control Script Flow with Comparisons
        1. 3.4.1. How Do I Do That?
        2. 3.4.2. What Just Happened?
          1. 3.4.2.1. The if statement
          2. 3.4.2.2. The switch statement
        3. 3.4.3. What About...
        4. 3.4.4. Where Can I Learn More?
      5. 3.5. Do Repetitive Work with Loops
        1. 3.5.1. How Do I Do That?
        2. 3.5.2. What Just Happened?
          1. 3.5.2.1. The for loop
          2. 3.5.2.2. The while loop
          3. 3.5.2.3. The foreach loop
          4. 3.5.2.4. Formatting strings
        3. 3.5.3. What About...
        4. 3.5.4. Where Can I Learn More?
      6. 3.6. Capture Reusable Behavior in a Function
        1. 3.6.1. How Do I Do That?
        2. 3.6.2. What Just Happened?
        3. 3.6.3. What About...
      7. 3.7. Transform Objects as They Pass Through the Pipeline
        1. 3.7.1. How Do I Do That?
        2. 3.7.2. What Just Happened?
        3. 3.7.3. What About...
      8. 3.8. What's Next?
    7. 4. Managing MSH Scope and State
      1. 4.1. Control Access to Variables and Functions
        1. 4.1.1. How Do I Do That?
        2. 4.1.2. What Just Happened?
          1. 4.1.2.1. Global scope
          2. 4.1.2.2. Local scope
          3. 4.1.2.3. Script scope
          4. 4.1.2.4. Private scope
        3. 4.1.3. What About...
      2. 4.2. Work with Special Characters
        1. 4.2.1. How Do I Do That?
        2. 4.2.2. What Just Happened?
        3. 4.2.3. What About...
      3. 4.3. Use Wildcards to Define a Set of Items
        1. 4.3.1. How Do I Do That?
        2. 4.3.2. What About...
        3. 4.3.3. Where Can I Learn More?
      4. 4.4. Take String Comparison Beyond -eq, -lt, and -gt
        1. 4.4.1. Regular Expressions
        2. 4.4.2. How Do I Do That?
        3. 4.4.3. What About...
        4. 4.4.4. Where Can I Learn More?
      5. 4.5. When Things Go Wrong
        1. 4.5.1. How Do I Do That?
        2. 4.5.2. What Just Happened?
        3. 4.5.3. What About...
      6. 4.6. What's Next?
    8. 5. Adding to the MSH Toolkit
      1. 5.1. Extend the Toolkit with Generic Cmdlets
        1. 5.1.1. How Do I Do That?
        2. 5.1.2. What About...
        3. 5.1.3. Where Can I Learn More?
      2. 5.2. Work with Text Files
        1. 5.2.1. How Do I Do That?
        2. 5.2.2. What About ...
        3. 5.2.3. Where Can I Learn More?
      3. 5.3. Work with Structured File Formats
        1. 5.3.1. How Do I Do That?
        2. 5.3.2. What About...
        3. 5.3.3. Where Can I Learn More?
      4. 5.4. How Variables Relate to the .NET Framework
        1. 5.4.1. How Do I Do That?
        2. 5.4.2. What Just Happened?
        3. 5.4.3. Where Can I Learn More?
      5. 5.5. Calling Methods of the .NET Class Library
        1. 5.5.1. How Do I Do That?
        2. 5.5.2. What Just Happened?
        3. 5.5.3. What About ...
        4. 5.5.4. Where Can I Learn More?
      6. 5.6. Using new-object with COM Objects
        1. 5.6.1. How Do I Do That?
      7. 5.7. What's Next?
    9. 6. Working with Operating System Components
      1. 6.1. Monitoring the Event Log
        1. 6.1.1. How Do I Do That?
        2. 6.1.2. What Just Happened?
        3. 6.1.3. What About...
        4. 6.1.4. Where Can I Learn More?
      2. 6.2. Auditing System Services
        1. 6.2.1. How Do I Do That?
        2. 6.2.2. What Just Happened?
        3. 6.2.3. What About...
        4. 6.2.4. Where Can I Learn More?
      3. 6.3. Get System Information from WMI
        1. 6.3.1. How Do I Do That?
        2. 6.3.2. What Just Happened?
        3. 6.3.3. What About...
        4. 6.3.4. Where Can I Learn More?
      4. 6.4. Manage Filesystem Permissions
        1. 6.4.1. How Do I Do That?
        2. 6.4.2. What Just Happened?
        3. 6.4.3. What About ...
        4. 6.4.4. Where Can I Learn More?
      5. 6.5. What's Next?
    10. 7. Putting MSH to Work
      1. 7.1. Invoke Commands with &
        1. 7.1.1. How Do I Do That?
        2. 7.1.2. What Just Happened?
        3. 7.1.3. What About ...
      2. 7.2. Parse Text-Based Application Output
        1. 7.2.1. How Do I Do That?
        2. 7.2.2. What Just Happened?
        3. 7.2.3. What About ...
      3. 7.3. Fill In the Blanks: Take Input from the Console
        1. 7.3.1. How Do I Do That?
        2. 7.3.2. Where Can I Learn More?
      4. 7.4. Untangle GOTO-Based Batch Files
        1. 7.4.1. How Do I Do That?
        2. 7.4.2. What Just Happened?
      5. 7.5. Recap: Replacing Common Batch File Syntax
      6. 7.6. Renaming Multiple Files at Once
      7. 7.7. Match and Replace Content in a Text File
      8. 7.8. List Recently Changed Files
      9. 7.9. Counting Types of Files
      10. 7.10. Find Out Which Command Is Being Run
      11. 7.11. Downloading Content from the Web
      12. 7.12. Shorthand for Frequently Used Data
      13. 7.13. Returning System Uptime
      14. 7.14. Simple UI Automation
      15. 7.15. Colorize the Output of get-childitem
      16. 7.16. What's Left?
    11. A. Syntax and Grammar
      1. A.1. Cmdlets
      2. A.2. Operators
        1. A.2.1. Arithmetic
        2. A.2.2. Assignment
        3. A.2.3. Negation
        4. A.2.4. General Comparison
        5. A.2.5. String Comparison
        6. A.2.6. Array-Containment Operators
        7. A.2.7. Bitwise Operators
      3. A.3. Data Types
        1. A.3.1. Numbers
        2. A.3.2. Strings
        3. A.3.3. Arrays
        4. A.3.4. Hashtables (Associative Arrays)
      4. A.4. Automatic Variables
      5. A.5. Global Variables
      6. A.6. Preference Variables
      7. A.7. Execution Flow
        1. A.7.1. if Statement
        2. A.7.2. switch Statement
      8. A.8. Loops
        1. A.8.1. while Loop
        2. A.8.2. for Loop
        3. A.8.3. foreach Loop
      9. A.9. Functions and Filters
        1. A.9.1. Functions
        2. A.9.2. Filters
      10. A.10. Resolution Order
    12. B. Standard Cmdlets, Functions, and Aliases
      1. B.1. Standard Cmdlets
        1. B.1.1. System
        2. B.1.2. Objects
        3. B.1.3. History
        4. B.1.4. Cmdlet Providers
          1. B.1.4.1. Drives
          2. B.1.4.2. Paths and locations
          3. B.1.4.3. Properties
          4. B.1.4.4. Items
          5. B.1.4.5. Content
        5. B.1.5. Operating System Components
        6. B.1.6. Output Formatters
        7. B.1.7. Aliases
        8. B.1.8. Miscellaneous
        9. B.1.9. Variables
        10. B.1.10. Input/Output
        11. B.1.11. Security
        12. B.1.12. Debugging
      2. B.2. Standard Functions
      3. B.3. Aliases
    13. About the Author
    14. Colophon
    15. SPECIAL OFFER: Upgrade this ebook with O’Reilly