Preview PowerShell 3 in the new Windows Management Framework 3 Beta
Microsoft recently released Windows Management Framework (WMF) 3 Beta, which includes PowerShell 3 as well as updates to WMI and WinRM.
As we covered here on InfoQ when the WMF 3 CTP was announced, PowerShell 3 includes several new features. Among the highlights:
Workflows can be used to create parallelized, long-running tasks that are capable of being interrupted and recovering even when a machine is shut down. This feature takes advantage of functionality in Windows Workflow Foundation (WWF); PowerShell scripts are translated into WWF code to create the workflows. Similarly, more robust sessions allow better recovery from network interruptions and shutdowns, so that tasks can continue running where they left off.
PowerShell 3 uses the Dynamic Language Runtime, which should provide substantial performance improvements over PowerShell 2. The parser has been rewritten, and the API is now public. Adam Driscoll writes about these changes:
The Compiler class is an ICustomAstVisitor. This means that the compiler tells the AST how it should be traversed. After some perusing around the members within this class I ran into the Compile method. The method accepts an AST and outputs an Expression. This means that the compiler visits each node into the AST and compiles it into a LINQ expression tree. Pretty wicked stuff! This expression can then be compiled and invoked. ... They are then stored as a DynamicMethod within the current process. Since it is compiled it won't need to be reinterpreted in the future.
In addition, there is a new Integrated Scripting Environment (ISE) add-on (available via the Server Manager in PowerShell) that makes it easier for users to find the correct command, check syntax and view the required and optional parameters. The ISE supports IntelliSense as well, and allows commands to either be run directly from the ISE or inserted into scripts.
Also included in the WMF 3 beta release are updated versions of Windows Management Instrumentation (WMI) and Windows Remote Management (WinRM). There is a new Server Manager CIM Provider that lets users manage Windows 2008 servers from WMF in Windows Server 8 Beta. Finally, Microsoft has introduced the Windows PowerShell Web Service, which exposes PowerShell cmdlets via a RESTful interface so that clients not currently supporting WMF can still access some of its functionality using the OData protocol.
WMF 3 can be used on Windows 7 SP1, Windows Server 2008 R2 SP1 and Windows Server 2008 SP2. (Support for both 32-bit and 64-bit versions of 2008 SP2 is new in this release.) As of yet, there is no information from Microsoft as to whether it will eventually be available for older operating systems. PowerShell 3 is also included as part of the Windows 8 Beta.