Feb 15, 2010

Windows7 - What’s new in Windows PowerShell 2.0

PowerShell 2.0 is now included in Windows 7 and Windows Server 2008 R2. As of October 2009, PowerShell 2.0 is available to download for Windows XP SP3, Windows 2003 SP2, Windows Vista-SP1, and Windows Server 2008 RTM.

Windows PowerShell 2.0 includes several significant features that extend its use, improve its usability, and allow you to control and manage Windows-based environments more easily and comprehensively. Windows PowerShell 2.0 is backward compatible: Cmdlets, providers, snap-ins, scripts, functions, and profiles that were designed for Windows PowerShell 1.0 work in Windows PowerShell 2.0 without changes.

So with that, let’s check out some of the new features:

Remoting - The PowerShell 2.0 install now includes WinRm 2.0 (Windows Remote Management),  which is our implementation of the WS-Management Protocol. WS-Management allows systems the ability to access and exchange management information across an IT infrastructure. This new ability allows you to run commands on one or more remote computers from a single computer that is also running Windows PowerShell. To configure PowerShell remoting, the following must be accomplished:

1. Start PowerShell as an administrator

2. Use the “Enable-PSRemoting” cmdlet. The “Enable-PSRemoting” cmdlet performs the following operations:

    • Runs the Set-WSManQuickConfig cmdlet, which performs the following tasks:
    • Starts the WinRM service.
    • Sets the startup type on the WinRM service to Automatic.
    • Creates a listener to accept requests on any IP address.
    • Enables a firewall exception for WS-Management communications.
    • Enables all registered Windows PowerShell session configurations to receive instructions from a remote computer.
    • Registers the "Microsoft.PowerShell" session configuration, if it is not already registered.
    • Registers the "Microsoft.PowerShell32" session configuration on 64-bit computers, if it is not already registered.
    • Removes the "Deny Everyone" setting from the security descriptor for all the registered session configurations.
    • Restarts the WinRM service to make the preceding changes effective.

New Cmdlets - PowerShell 2.0 introduces over 100 built-in cmdlets. These cmdlets allow you to do computer-related, event log, and performance counter management tasks, among others. To see a list of new cmdlets that support the remote –computername parameter, type in the following command at a PS > prompt:

Get-Command -CommandType cmdlet | Where-Object { $_.definition -match 'computername' } | Format-Wide -property name –AutoSize

To view a list of all included cmdlets, run the following command at the PS> prompt:


Script Debugging - For all you debuggers out there, you can now set breakpoints on lines, columns, variables and commands, and then let you specify the action that occurs when the breakpoint is hit. To get help on Debugging your PowerShell scripts, type in the following command at a PS > prompt:

Help Set-PSDebug

PowerShell GUI - Looking for a PowerShell GUI? Well, now you have it with the PowerShell Integrated Scripting Environment (ISE). This new functionality enables you to run interactive commands and edit and debug scripts in a graphical environment. The main features include color-coded syntax, selective execution, graphical debugging, Unicode support, and context-sensitive help. To launch the PowerShell GUI, run PowerShell_ISE.exe.

Note: you must install the Windows PowerShell Integrated Scripting Environment feature to get the PowerShell GUI.

Background Jobs – PowerShell 2.0 now allows you to run commands or expressions asynchronously and “in the background” without interacting with the console. When you run a background job, the command prompt returns immediately, even if the command is still running. The get-command *-job command will give you a list of job cmdlets that you can use to schedule your jobs.

This is only a small listing of new features included in PowerShell 2.0. To get a complete list, checkout the links below or the about_Windows_PowerShell_2.0 help section included with PowerShell 2.0.


Text Widget

Copyright © Vinay's Blog | Powered by Blogger

Design by | Blogger Theme by