Chapter 13. PowerShell

PowerShell is Microsoft's administrative scripting tool incorporated into Windows Server 2008. Windows administrators can learn PowerShell to script common management tasks. PowerShell is a download that is available for Windows XP, Server 2003, and Vista; it is included within Windows Server 2008 as a feature you add to the base OS. Under development for several years, the first public view of the product was at the Professional Developer's conference in September 2003. The first release (PowerShell on Windows XP and Windows 2003 Server) occurred in November 2006, with versions for Vista and Longhorn server coming during 2007.

PowerShell is a command shell, similar to Unix shells like C-shell and Bourne shell or Microsoft's CMD.EXE shell, focused on the administrator (as opposed to a programmer). With PowerShell, an administrator can enter interactive commands as well and run more detailed scripts. Scripts can take parameters and produce output in a variety of forms.

PowerShell has the composability of the best versions of Unix/Linux shells, with the programming power of Ruby or Perl. Finally, it's built on top of the .NET framework. This means you can access just about any .NET feature directly from PowerShell, as well as accessing COM and WMI objects.

In this chapter, we will first look at the background to PowerShell and why Microsoft developed it. Next, we'll examine how to install it, and use it both at the command line and as a scripting tool. Finally, ...

Get Windows Server 2008: The Definitive Guide 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.