- What Is a Shell?
- A Shell History
- Enter PowerShell
- New Capabilities in PowerShell 2.0 CTP2
- Summary
New Capabilities in PowerShell 2.0 CTP2
With the release of PowerShell 2.0 CTP2, the PowerShell team has expanded the capabilities of PowerShell 1.0 to include a number of key new features. Although PowerShell 2.0’s final feature set is likely to change from the CTP2 release, these features are central to PowerShell 2.0 and are expected to make it into the final release of the product.
The first major new feature of PowerShell 2.0 CTP2 is the addition of PowerShell Remoting. In a major step forward from the original release of PowerShell 1.0, PowerShell 2.0 CTP2 provides support for running cmdlets and scripts on a remote machine. The Windows Remote Management Service (WS-Man) is used to accomplish this, and a new cmdlet named Invoke-Expression is used to designate the target machine and the command to be executed. The following code example shows the general usage of the Invoke-Expression cmdlet to run the command get-process powershell on a remote computer named XP1.
PS C:\> invoke-expression -comp XP1 -command "get-process powershell" Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 522 12 30652 29076 158 3.70 1168 powershell PS C:\>
Another new feature of PowerShell 2.0 CTP2 is the introduction of background jobs or PSJobs. A PSJob is simply a command or expression that executes asynchronously, freeing up the command prompt immediately for other tasks. A new series of Cmdlets related to PSJobs are included, which enable PSJobs to be started, stopped, paused, and listed. It also enables the results analyzed.
Also included in PowerShell 2.0 CTP2 is a new functionality called ScriptCmdlets. Previously, cmdlets had to be written in a .NET framework programming language such as C#, which made it a challenge for many scripters to create their own cmdlets. In this release of PowerShell, the ScriptCmdlets functionality enables scripters to write their own cmdlets with no more effort than writing a PowerShell function. While ScriptCmdlets are handled differently from compiled cmdlets and have certain limitations in this release of PowerShell (such as lack of support for help files), this functionality makes it far easier for scripters to extend PowerShell to address their specific requirements.
The last new feature of PowerShell 2.0 CTP2 that we discuss in this chapter is the introduction of Graphical PowerShell. Graphical PowerShell is currently in an early alpha version, but includes a number of powerful new capabilities that enhance the features of the basic PowerShell CLI shell. Graphical PowerShell provides an interface with both an interactive shell pane and a multi-tabbed scripting pane, as well as the ability to launch multiple shell processes (also known as runspaces) from within Graphical PowerShell.
All of these new features and more are discussed and demonstrated in more detail in subsequent chapters.