CHAPTER 3

Making Your PowerShell Reusable

IN THIS CHAPTER, YOU WILL LEARN TO:

  • SCRIPT YOUR SOLUTIONS

    Create and Execute Scripts

    Execute Script Blocks

    Define Script Parameters

    Comment Your Scripts

  • UNDERSTAND THE USE OF FUNCTIONS

    Create Functions

    Define Function Parameters

    Process Pipeline Data

    Understand Scopes

  • COMPARTMENTALIZE WITH MODULES

    Create and Load Script Modules

    Create Module Manifests

  • ADD ERROR HANDLING TO SCRIPTS

    Throw Errors

    Use Trap Blocks

    Use Try/Catch/Finally Blocks

    Understand Object Disposal Issues

Until now, all the examples you've seen could easily be done within the Windows PowerShell console window, where each command is entered and executed one line at a time. Using the Windows PowerShell console window is great for really ...

Get Automating Microsoft® SharePoint® 2010 Administration with Windows PowerShell® 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.