Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Introducing PowerShell 2

Introducing PowerShell 2

This item in japanese


PowerShell 2 has been in the works for a long time with the first technical preview dating back nearly two years. Here is a small taste of the numerous features they have added since then.

  • Remoting: Cmdlets and Scripts can be executed on remote machines.
  • Background Jobs: Background jobs can be started both locally and remotely using PsJob.
  • ScriptCmdlets: Previously Cmdlets needed to be written in a statically compiled language such as C# or VB. Now they can be written directly in PowerShell script.
  • Steppable Pipelines: Pipelines can be treated like objects with elements being passed in one item at a time.
  • Data Sections: Data sections allow data needed by a script to be separated from the logic itself. In addition to the organizational benefits, this also allows for internationalizing scripts.
  • Script Debugging: Breakpoints can be set on “lines, columns, functions, variables, and commands”.
  • The “splat” operator: The @ operator can be used to pass a collection of key-values pairs as a single parameter.
  • PowerShell ISE: The “Integrated Scripting Environment” is a lightweight IDE that is split into three panes. The top pane is for editing scripts while the lower pane is used for immediately executing individual commands just like from a normal PowerShell prompt. This isn’t really needed though, as the top panel also supports executing highlighted commands just like SQL Server Management Studio.
  • Out-GridView: Instead of just dumping data onto the console, you now have the option to send it to a pop-up window with live grid that supports sorting and filtering.
  • Modules: Modules replace snap-ins as a way to create reusable libraries of cmdlets, scripts, and providers. Unlike Snap-ins, which have to be installed, Modules can be simply copied to a user or system-wide folder. Once there, they can be directly imported by any script that needs them.
  • Events: WMI and CLR events can now be sent to an event queue or bound directly to an action.
  • Transactions: A transactional framework now exists, though currently the only supported provider is for the registry.
  • Error Handling Blocks: The standard try-catch-finally blocks seen in Java, C#, and VB are now available in PowerShell as well.
  • Add-Type: This uses the CodeDOM to compile code fragments from any .NET language.

The release canidate for PowerShell 2.0 is now available on XP and later operating systems.

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • Warning!!!

    by Marc Vitalis,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    If you were able to install this, don't try to do an uninstall. This will mess up your .Net Runtime Optimization service.

  • Re: Warning!!!

    by Anders Persson,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Tanks for the warning

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p