Partager via


What's New in Windows PowerShell

Applies To: Windows Server 2008 R2

Windows PowerShell™ is a command-line shell and scripting language designed especially for system administration. Built on the Microsoft .NET Framework, Windows PowerShell helps IT professionals control and automate the administration of Windows operating systems and of applications that run on Windows.

The simple command tools in Windows PowerShell, called cmdlets, let you manage the computers in your enterprise from the command line. Windows PowerShell providers let you access data stores, such as the registry and the certificate store, as easily as you access the file system. In addition, Windows PowerShell has full support for all Windows Management Instrumentation (WMI) classes.

Windows PowerShell is fully extensible. You can write your own cmdlets, providers, functions, and scripts, and you can package them in modules to share with other users.

Windows Server® 2008 R2 includes Windows PowerShell 2.0. It also includes cmdlets and providers that you can add to Windows PowerShell so that you can use and manage other Windows Server roles and features in Windows PowerShell. The server roles and features that you can manage in Windows PowerShell include Active Directory® Domain Services, Windows® BitLocker™ Drive Encryption, the DHCP Server service, Group Policy, Remote Desktop Services, and Windows Server Backup. For more information, see What's New in Windows PowerShell Cmdlets for Roles and Features.

What are the major changes?

The following changes are available in Windows PowerShell in Windows Server 2008 R2:

  • New cmdlets. Windows PowerShell includes more than 100 new cmdlets, including Get-Hotfix, Send-MailMessage, Get-ComputerRestorePoint, New-WebServiceProxy, Debug-Process, Add-Computer, Rename-Computer, and Reset-ComputerMachinePassword.

  • Remote management. You can run commands on one computer or on hundreds of computers by using a single command. You can establish an interactive session with a single computer, or you can establish a session that can receive remote commands from multiple computers.

  • Windows PowerShell Integrated Scripting Environment (ISE). Windows PowerShell ISE is a graphical user interface for Windows PowerShell that lets you run commands and write, edit, run, test, and debug scripts in the same window. It offers up to eight independent execution environments and includes a built-in debugger, multiline editing, selective execution, syntax colors, line and column numbers, and context-sensitive Help. Windows PowerShell ISE is an optional feature of Windows Server 2008 R2. To install it, use the Add Features Wizard.

  • Background jobs. With Windows PowerShell background jobs, you can run commands asynchronously and "in the background" so you can continue to work in your session. You can run background jobs on a local or remote computer, and you can store the results locally or remotely.

  • Debugger. The Windows PowerShell debugger can help you debug functions and scripts. You can set and remove breakpoints, step through code, check the values of variables, and display a call-stack trace.

  • Modules. Windows PowerShell modules let you organize your Windows PowerShell scripts and functions into independent, self-contained units. You can package your cmdlets, providers, scripts, functions, and other files into modules that you can distribute to other users. Modules are easier for users to install and use than Windows PowerShell snap-ins. Modules can include any type of file, including audio files, images, Help files, and icons. Modules run in a separate session to avoid name conflicts.

  • Transactions. Windows PowerShell now supports transactions, which let you manage a set of commands as a logical unit. A transaction can be committed, or it can be completely undone so that the affected data is not changed by the transaction.

  • Events. Windows PowerShell includes a new event infrastructure that lets you create events, subscribe to system and application events, and then listen, forward, and act on the events synchronously and asynchronously.

  • Advanced functions. Advanced functions behave just like cmdlets, but are written in the Windows PowerShell scripting language instead of in C#.

  • Script internationalization. Scripts and functions can display messages and Help text to users in multiple languages.

  • Online Help. In addition to Help at the command line, the Get-Help cmdlet has a new Online parameter that opens a complete and updated version of each Help topic on Microsoft TechNet.

Who will be interested in this feature?

The following groups might be interested in these changes:

  • IT professionals who want to manage Windows at the command line and automate administrative tasks.

  • Developers who want to use the extensive Windows PowerShell scripting language to build .NET Framework applications and extend Windows PowerShell.

  • All users who want to learn Windows PowerShell to manage their system, write scripts to automate their tasks, and create new tools without having to learn a programming language.

Are there any special considerations?

Windows PowerShell has the following system and feature requirements:

  • Windows PowerShell requires the Microsoft .NET Framework 2.0.

  • Windows PowerShell ISE, the graphical user interface program for Windows PowerShell, requires the Microsoft .NET Framework 3.5 with Service Pack 1. When you use the Add Features Wizard to add Windows PowerShell ISE, the wizard also adds the required version of the Microsoft .NET Framework if it is not already installed on the system.

  • The Out-GridView cmdlet requires the Microsoft .NET Framework 3.5 with Service Pack 1.

  • The Get-WinEvent cmdlet requires Windows Vista® or later versions of Windows and the Microsoft .NET Framework 3.5.

  • The Export-Counter cmdlet runs only on Windows Server 2008 R2, Windows® 7, and later versions of Windows.

  • The WMI-based remoting features of Windows PowerShell require no configuration and run on all versions of Windows that support Windows PowerShell. The WS-Management-based remoting features require both the local and remote computers to run Windows Vista or a later version of Windows. Also, you must enable and configure WS-Management on all participating computers. For more information, see About_Remote.

  • Several cmdlets work only when the current user is a member of the Administrators group on the computer or when the current user can provide the credentials of a member of the Administrators group. This requirement is explained in the Help topics for the affected cmdlets.

What settings have been added or changed?

The value of the PowerShellVersion registry entry in HKLM\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine has been changed.

Registry settings

Setting name Location Previous default value (if applicable) Default value Possible values

PowerShellVersion

HKLM\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine

1.0

2.0

1.0, 2.0

Group Policy settings

Setting name Location Previous default value (if applicable) Default value Possible values

Turn on Script Execution

Administrative Templates\Classic Administrative Templates\Windows Components\Windows PowerShell

Restricted

Restricted

Restricted, AllSigned, RemoteSigned, Unrestricted

Do I need to change any existing code?

No. Windows PowerShell 2.0 is backward-compatible. Functions, scripts, cmdlets, and providers written for Windows PowerShell 1.0 should run in Windows PowerShell 2.0 without changes. The few breaking changes are listed and explained in the release notes that accompany the product.

How should I prepare to deploy this feature?

WS-Management-based remoting requires Windows PowerShell to be installed in all local and remote computers. The computers must be running Windows Vista or a later version of Windows. The WS-Management remoting feature must be enabled and configured.

Which editions include this feature?

Windows PowerShell is available in all editions. Windows PowerShell ISE is an optional component of Windows Server 2008 R2. To install it, use the Add Features Wizard.

Is it available in both 32-bit and 64-bit versions?

Yes.

Additional references

In addition to the Help that is available at the command line, you can refer to the following resources for more information:

  • Windows PowerShell Help on TechNet. Complete and updated versions of the Windows PowerShell Help topics on Microsoft TechNet.

  • Windows PowerShell Blog. The best resource for learning from and collaborating with other Windows PowerShell users. Read the Windows PowerShell blog, and then join the Windows PowerShell User Forum (microsoft.public.windows.powershell). Use Windows Live Search to find other Windows PowerShell blogs and resources. Then, as you develop your expertise, freely contribute your ideas.

  • Windows PowerShell SDK. Provides reference content used to develop cmdlets, providers, and host applications.

  • Windows PowerShell Programmer's Guide. Provides tutorials for creating cmdlets, providers, and hosting applications. Also contains information about fundamental Windows PowerShell concepts.

See Also

Other Resources

What's New in Windows PowerShell Cmdlets for Roles and Features