No two Windows OSs are the same, just as no two versions of Windows PowerShell are the same. The steps you take to run PowerShell 2.0 on Windows 8 are much different from those needed to run PowerShell 3.0 on Windows Server 2008. Yet the abundance of PowerShell documentation can make it difficult to know exactly what to do for a specific PowerShell version on a specific OS.

I'll try to simplify the information about system requirements by breaking it down according to the OS. Specifically, I'll cover those OSs that can run both PowerShell 2.0 and 3.0: Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2, and Server 2008. For each OS, I'll provide details about running both versions of PowerShell as well as the PowerShell Integrated Scripting Environment (ISE). In some cases, you'll find little difference between OSs when it comes to running PowerShell, but even then, I'll try to clearly delineate those differences so that you fully understand how to implement PowerShell in your environment.

Windows 8

If you're already running Windows 8, you're in luck. The PowerShell 3.0 engine and ISE come installed and enabled. You can launch either one as you would any other application—from the Start menu, the desktop, or a Windows command prompt. PowerShell 3.0 is ready to go as soon as you're ready to use it.

That's not the case for PowerShell 2.0. Although the PowerShell 2.0 engine is part of the package—that is, it's installed in Windows 8—you have to first enable Microsoft .NET Framework 3.5. There's a reason for this. Because the PowerShell 2.0 engine is compiled with the Common Language Runtime (CLR) 2.0, it requires .NET 3.5 or earlier (back to .NET 2.0). PowerShell 3.0 requires .NET 4.0 or .NET 4.5, both of which are based on CLR 4.0. In Windows 8, .NET 4.5 is installed and enabled by default, which is one reason why you can run PowerShell 3.0 out of the box.

If you want the ability to run the PowerShell 2.0 engine and the PowerShell 3.0 engine, you must first select the option .NET Framework 3.5 (includes .NET 2.0 and 3.0) in Windows Features. This enables .NET 3.5 and lets you run PowerShell 2.0 alongside PowerShell 3.0. However, you won't find a Start menu option that launches PowerShell 2.0. Instead, you must run the following command at a Windows or PowerShell command prompt:

powershell -version 2

Once you run this command, any subsequent commands you run within the current session will be processed by the PowerShell 2.0 engine. But keep in mind that PowerShell 3.0 is backward compatible with PowerShell 2.0 cmdlets, providers, scripts, modules, and snap-ins. So, the only time you should need to access the PowerShell 2.0 engine is when you want to check the compatibility of a script or host program written specifically for PowerShell 2.0 and CLR 2.0.

Also be aware that you can't run the PowerShell 2.0 ISE when PowerShell 3.0 is installed. In such circumstances, you can run PowerShell 2.0 only within a command shell. You can, however, use the PowerShell 3.0 ISE to create your script, then run it in PowerShell 2.0 to verify its compatibility. It might not be the best solution, but at least it's a solution.

Windows Server 2012

When it comes to PowerShell, Server 2012 is a lot like Windows 8. By default, the PowerShell 3.0 engine and ISE are installed, enabled, and ready to go. You can launch them from the Start menu, the desktop, or a Windows command prompt. Plus, you can start PowerShell 3.0 from Server Manager.

However, for PowerShell 2.0, you need to take a slightly different approach to prepare your system than you take with Windows 8. To begin with, you must add the .NET 3.5 feature rather than simply enabling it. To do so, use the Add Roles and Features function in Server Manager to add the .NET Framework 3.5 (includes .NET 2.0 and 3.0) feature. To access this feature, choose the Role-based or feature-based installation type when you get to the Installation Type page.

The next step in preparing for PowerShell 2.0 is to add the actual engine. Again, use the Add Roles and Features function in Server Manager, select Role-based or feature-based installation as the installation type, and select the Windows PowerShell 2.0 Engine feature.

After you add the .NET 3.5 and PowerShell 2.0 engine features, you can launch the PowerShell 2.0 engine. To do so, run the following command at a Windows or PowerShell command prompt:

powershell -version 2

Windows 7

Unlike Windows 8 and Server 2012, Windows 7 doesn't come with the PowerShell 3.0 engine and ISE installed. Rather, Windows 7 comes with the PowerShell 2.0 engine and ISE, both of which are installed, enabled, and ready to use.

Note that if you right-click the PowerShell icon in the Start menu and select Properties, the target location might show v1.0, as seen in Figure 1. However, PowerShell 2.0 is actually running, which you can verify by opening PowerShell and running the Get-Host command.

Figure 1: Target Location Showing v1.0 When PowerShell 2.0 Is Actually Running

You can launch either the PowerShell 2.0 engine or ISE from the Start menu or a command prompt. To start PowerShell 2.0 at a Windowscommand prompt, run the command

powershell

To start the PowerShell 2.0 ISE at a Windows or PowerShell command prompt, run the command

powershell_ise

Windows 7 will support PowerShell 3.0, but you must take several steps to get it up and running:

  1. Install Windows 7 SP1 if you haven't already done so.
  2. Install the full installation of either .NET 4.0 or .NET 4.5.
  3. Uninstall any previous builds of Windows Management Framework (WMF) 3.0.
  4. Install the most recent build of WMF 3.0.

In addition to including both the PowerShell 3.0 engine and ISE, WMF 3.0 includes a couple other components that PowerShell 3.0 requires:

  • WS-Management 3.0. This component supports the Windows Remote Management (WinRM) service and WSMan protocol, which enable PowerShell's remote management features.
  • Windows Management Instrumentation (WMI) 3.0. This component supports features that require WMI, such as Common Information Model (CIM) commands.

Installing .NET and WMF are straightforward processes, but be sure to read all the instructions on the download pages before installing either on your system. Of particular note is the fact that WMF 3.0 isn't compatible with a number of applications:

  • Microsoft System Center 2012 Configuration Manager
  • Microsoft System Center 2012 Virtual Machine Manager
  • Microsoft Exchange Server 2012
  • Microsoft Exchange Server 2007
  • Microsoft SharePoint 2010
  • Windows Small Business Server 2011
  • Windows Small Business Server 2008

If your system is running any of these applications, you shouldn't install WMF 3.0, which makes upgrading to PowerShell 3.0 unlikely (unless you can come up with a workaround).

However, assuming that you can move forward with the WMF 3.0 installation, you'll be ready to run the PowerShell 3.0 engine and ISE as soon as that installation is complete. You start the PowerShell 3.0 engine and ISE exactly the same way you start the PowerShell 2.0 engine and ISE in Windows 7 (i.e., from the Start menu or a command prompt). If you want to run the PowerShell 2.0 engine, you issue the following command from a Windows or PowerShell command prompt:

powershell -version 2

Note, however, that once you install WMF 3.0, the only way you'll be able to access the PowerShell 2.0 engine is by issuing this command. In addition, you'll no longer be able access the PowerShell 2.0 ISE, and you won't be able to run the PowerShell 2.0 engine from within the PowerShell ISE 3.0 environment. You'll need to use the PowerShell command shell for 2.0 operations. However, as with Windows 8 and Server 2012, you'll be able to use PowerShell 3.0 ISE to create your scripts and run them against the PowerShell 2.0 engine to verify their compatibility.

Windows Server 2008 R2

Server 2008 R2 is quite similar to Windows 7 with regard to PowerShell. By default, the PowerShell 2.0 engine and ISE are automatically installed on your system. However, unlike Windows 7, Server 2008 R2 enables the engine but not the ISE. You have to do that manually by using the Add Features function in Server Manager to add the Windows PowerShell Integrated Scripting Environment (ISE) option. Once you've added this feature, you can start either the PowerShell 2.0 engine or ISE as you would in Windows 7 (i.e., from the Start menu or a command prompt).

Upgrading from PowerShell 2.0 to PowerShell 3.0 in Server 2008 R2 is similar to the upgrade process in Windows 7. You install SP1, install .NET 4.0 or .NET 4.5, uninstall any previous builds of WMF 3.0, and install the most recent build of WMF 3.0, following the same precautions noted for Windows 7. However, if you want to use the PowerShell 3.0 ISE after the upgrade, you must be sure that the PowerShell 2.0 ISE feature has been enabled before you install WMF 3.0.

After you've installed WMF 3.0, you can launch the PowerShell 3.0 engine and ISE as you would in Windows 7 (i.e., from the Start menu or a command prompt). To access the PowerShell 2.0 engine, you run the following command at a Windows or PowerShell command prompt:

powershell -version 2

Windows Server 2008

When it comes to PowerShell, where you'll really see a departure from the other OSs is with Server 2008. This OS includes neither PowerShell 2.0 nor PowerShell 3.0 out of the box. As a result, you have more work to do to run either version on your system.

If you want to install the PowerShell 2.0 engine and ISE on your Server 2008 computer, you should first uninstall any previous version of PowerShell or WinRM. Next, you should install the WMF Core, which includes the PowerShell 2.0 engine and ISE as well as WinRM 2.0. You can then run PowerShell as you would in Windows 7 or Server 2008 R2.

Installing the PowerShell 3.0 engine and ISE is not quite so simple and requires a number of additional steps:

  • Install Server 2008 SP2 if it's not already installed.
  • Install the WMF Core if it's not already installed. The WMF Core is a prerequisite for WMF 3.0 on Server 2008 computers.
  • Install the full installation of either .NET 4.0 or .NET 4.5.
  • Install Extended Protection for Authentication. This feature protects your system from forwarding attacks and lets you use the UseSSL parameter when creating remote sessions.
  • Uninstall any previous builds of WMF 3.0.
  • Install the most recent build of WMF 3.0.

After you've completed the installation process, you can access the PowerShell 3.0 engine and ISE just as you can in Windows 7 and Server 2008 R2 (i.e., from the Start menu or a command prompt). You can access the PowerShell 2.0 engine the same way you do in the other OSs by running the following command at a Windows or PowerShell command prompt:

powershell -version 2

The PowerShell Game

A PowerShell installation can be like a shell game—you need to try to figure out where the pieces are hidden. Yet if you know which version of PowerShell you want to run and on which OS you want to run it, it's merely a matter of zooming in on the correct set of instructions.

The good news is that you can run the PowerShell 3.0 engine and ISE on any of the OSs discussed here. With PowerShell 3.0, not only do you get a number of new core cmdlets, but you'll also find such features as Windows PowerShell Web Access, CIM integration, disconnected sessions, and support for Windows Workflow Foundation. The PowerShell 3.0 ISE has also been significantly enhanced with support for such features as IntelliSense, auto-save, block copy, brace matching, and expand-collapse sections. Best of all, you can still access the PowerShell 2.0 engine.

Even if you choose to stick with PowerShell 2.0 only, you must still make sure that you're working with the right PowerShell version and that it's running on the system you want it to run on. To that end, you should now have the information you need to set up the PowerShell 2.0 environment.