O'Reilly logo

Windows Server® 2008 Administrator’s Companion by Charlie Russel and Sharon Crawford

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Powershell Scripting Basics

Up to now, we’ve tried to give you an idea of how PowerShell works and some of its power when used as an interactive shell. In this section, we’ll focus on some PowerShell scripting basics, including:

  • Creating a .ps1 script

  • Variables

  • Scope

  • Strings

  • Here strings

  • Wildcards and regular expressions

  • Arrays

  • Hashtables

  • Operators

  • Conditional statements

  • Looping statements

  • Exiting from scripts, functions, and loops

  • Importing and exporting from and to files

  • Flow control cmdlets

  • Formatting cmdlets

  • Using functions in a script

  • Dot-sourcing

  • Passing arguments to a script or function

  • Param statement

  • Using the pipeline with $_ and $input

  • Adding comments to a script

  • Handling errors

  • Redirection operators

  • Type accelerator

  • Escaping characters

Creating a .ps1 Script ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required