Read more
List of contents
Foreword;
Preface;
Who This Book Is For;
How This Book Is Organized;
What You Need to Use This Book;
Conventions Used in This Book;
Using Code Examples;
How to Contact Us;
Safari® Enabled;
Acknowledgments;
Chapter 1: Introducing MSH;
1.1 Get MSH;
1.2 Get to Know Verb-Noun Syntax and Cmdlets;
1.3 Access the Registry Like a Filesystem;
1.4 Create a Pipeline to Pass Information;
1.5 Display Data;
1.6 What's Next?;
Chapter 2: Customizing MSH;
2.1 Load and Save Scripts;
2.2 Save Keystrokes with Aliases;
2.3 Work with the Command Line;
2.4 Make Yourself at Home;
2.5 Find Out What a Command Will Do Before Running It;
2.6 What's Next?;
Chapter 3: Scripting MSH;
3.1 The .NET Framework;
3.2 Work with Structured Objects;
3.3 Store Information in Variables;
3.4 Control Script Flow with Comparisons;
3.5 Do Repetitive Work with Loops;
3.6 Capture Reusable Behavior in a Function;
3.7 Transform Objects as They Pass Through the Pipeline;
3.8 What's Next?;
Chapter 4: Managing MSH Scope and State;
4.1 Control Access to Variables and Functions;
4.2 Work with Special Characters;
4.3 Use Wildcards to Define a Set of Items;
4.4 Take String Comparison Beyond -eq, -lt, and -gt;
4.5 When Things Go Wrong;
4.6 What's Next?;
Chapter 5: Adding to the MSH Toolkit;
5.1 Extend the Toolkit with Generic Cmdlets;
5.2 Work with Text Files;
5.3 Work with Structured File Formats;
5.4 How Variables Relate to the .NET Framework;
5.5 Calling Methods of the .NET Class Library;
5.6 Using new-object with COM Objects;
5.7 What's Next?;
Chapter 6: Working with Operating System Components;
6.1 Monitoring the Event Log;
6.2 Auditing System Services;
6.3 Get System Information from WMI;
6.4 Manage Filesystem Permissions;
6.5 What's Next?;
Chapter 7: Putting MSH to Work;
7.1 Invoke Commands with &;
7.2 Parse Text-Based Application Output;
7.3 Fill In the Blanks: Take Input from the Console;
7.4 Untangle GOTO-Based Batch Files;
7.5 Recap: Replacing Common Batch File Syntax;
7.6 Renaming Multiple Files at Once;
7.7 Match and Replace Content in a Text File;
7.8 List Recently Changed Files;
7.9 Counting Types of Files;
7.10 Find Out Which Command Is Being Run;
7.11 Downloading Content from the Web;
7.12 Shorthand for Frequently Used Data;
7.13 Returning System Uptime;
7.14 Simple UI Automation;
7.15 Colorize the Output of get-childitem;
7.16 What's Left?;
Appendix A: Syntax and Grammar;
A.1 Cmdlets;
A.2 Operators;
A.3 Data Types;
A.4 Automatic Variables;
A.5 Global Variables;
A.6 Preference Variables;
A.7 Execution Flow;
A.8 Loops;
A.9 Functions and Filters;
A.10 Resolution Order;
Appendix B: Standard Cmdlets, Functions, and Aliases;
B.1 Standard Cmdlets;
B.2 Standard Functions;
B.3 Aliases;
Colophon;
About the author
Andy Oakley is a graduate of Jesus College, Cambridge, England with a degree in Computer Science. Currently, as a Lead Program Manager at Microsoft, he is building the new publishing system for MSDN which hosts the hundreds of thousands of pages of developer documentation published by Microsoft.