Wednesday, June 20, 2012

How to install PowerShell 2.0 on Windows 2003 R2 SP2 32 bit

This is a post to explain how you can install PowerShell 2.0 on Windows 2003 R2 SP2 32bit (which, by default, has no PowerShell at all). As you might have noticed, yesterday I published a blog post explaining the steps to install PowerShell 3.0 on Windows 2008 R2 box. Unfortunately you cannot install the last version of this package on operating systems older than Windows 2008 because the code is different and you won't be able to launch the MSU installer (Windows6.1-KB2506143-x86.msu) because Windows 2003 simply can't read it. So, due to the lack of anything better, let's focus on PowerShell 2.0.

Here's what I did.

Downloaded and installed DotNet 4 (dotNetFx40_Full_x86_x64.exe, approximately 50 MB). Easy install, no reboot.

Now download and install the Windows Management Framework 2.0 (WindowsServer2003-KB968930-x86-ENG.exe, approximately 6 MB) from here. This package contains WinRM 2.0 and Windows PowerShell 2.0.

Go through the installation and there you are: just click 'Start', 'Run' and type 'PowerShell' then press 'Enter'. Check the value of the '$host' variable by simply entering it and pressing 'Enter' and you should get the expected output telling you that PowerShell 2.0 is up and running:
Name             : ConsoleHost
Version          : 2.0
InstanceId       : ddb04dd1-7a4b-4a66-8f71-8b925c7210b4
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace
The next step is to enable Remoting, with the help of the 'Enable-PSRemoting' cmdlet. Execute this cmdlet and press 'A' to confirm.

With 'netstat' we can now check that WinRM is effectively listening to remote requests:
netstat -abn |  find "5985"
  TCP               LISTENING       4
For your information, TCP port 5985 is the port PowerShell 2.0 uses for incoming unencrypted connections. Older versions of WinRM use TCP port 80 (or 443 for encrypted connections) by default.

The last step is to bind PowerShell 2.0 to DotNet 4.

By default PowerShell relies on DotNet 2, which you can verify with this command: '[environment]::Version'
The output is:
Major  Minor  Build  Revision
-----  -----  -----  --------
2      0      50727  4959
To change this, move to C:\WINDOWS\system32\WindowsPowerShell\v1.0 and create a new text document named 'powershell.exe.config', and set its content to:
<?xml version="1.0" encoding="utf-8" ?>
  <!-- -->
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" />
    <supportedRuntime version="v2.0.50727" />
Run again '[environment]::Version' and this time you will that PowerShell is using DotNet 4:
Major  Minor  Build  Revision
-----  -----  -----  --------
4      0      30319  1
So, here's my conclusions:
  • easy installation
  • no need to restart
  • unfortunately no PowerShell 3.0 support on Windows 2003
  • DotNet 4 runs fine on Windows 2003
For mire details about the topics covered here you can check:
Hope this posts will help you. Do not hesitate to share you experience with PowerShell on older systems.


  1. Thanks for information!

  2. Sometimes you have to install wic_x86_enu.exe before installing dotnet4.
    No restart required.
    Cool post.

  3. Great Work- You should have the publications for migration of SBS 2003 adjusted - Add this in as a note for servers that dis not get Powershell at all.

  4. Thanx a lot. It works without flaws...


Related Posts Plugin for WordPress, Blogger...