Weekend Scripter: Install PowerShell 3.0 on Windows 7

Weekend Scripter: Install PowerShell 3.0 on Windows 7

  • Comments 16
  • Likes

Summary: Microsoft Scripting Guy, Ed Wilson, talks about installing Windows PowerShell 3.0 on Windows 7—it’s easier than you think.

Microsoft Scripting Guy, Ed Wilson, is here. If you ever meet the Scripting Wife, she might very well tell you that my “honey-do list” at home is prodigious. We have tried everything from Excel spreadsheets to a SharePoint site—yet the list just continues to grow. Short of hiring someone to come and install ceiling fans, paint  walls, and trim shrubs, things just don’t seem to get done. This even carries over to routine network management tasks. The Scripting Wife has been complaining for some time about the need to upgrade her kitchen computer to Windows PowerShell 3.0. Ultimately, she just gave up, and went out and got a new Windows 8 laptop (a monster with 32 GB of RAM, multiple SSD and HDD, and a really cool keyboard that changes colors) so she could compete more effectively in the 2013 Scripting Games. Anyway, we have a few minutes at TechEd (nope it has not started yet, but we wanted to come by and make sure the Scripting Guys Booth is set up properly). While things are quiet, I thought I would upgrade her old laptop to Windows PowerShell 3.0.

Note   I announced the availability of Windows PowerShell 3.0 in PowerShell 3.0 is Now Available for Download!  I also talked about installing Windows PowerShell in Windows 7 in How Do I Install PowerShell on Windows 7 and Other Questions, but that was about Windows PowerShell 2.0. You may also be interested in My Five Favorite PowerShell 3.0 Tips and Tricks blog post.

I do not need to extol the virtues of Windows PowerShell 3.0. It is a significant upgrade that provides new features such as a simplified Where-Object and Foreach-Object syntax, automatic unraveling of objects, and Windows PowerShell workflow. I could write for months about Windows PowerShell 3.0—Oh wait! I have.

Check the version of Windows PowerShell

I learned a long time ago (back when I was a network administrator) to never assume anything. Do not rely on a users report of what they were doing when something broke (nearly always, the answer is, “I was not doing anything. It just broke.”), and to never assume the version of the operating system or the version of the application.

I once spent a frustrating 30 minutes on the phone trying to talk a user through doing something on Windows 95 when they were actually still running Windows 3.11. Talk about embarrassing. So first things first…check the version of Windows PowerShell by opening the Windows PowerShell console and looking at the value of the $psversiontable variable. The command is simple:

$PSVersionTable

Note   If nothing returns from $psversiontable, it may mean that you are looking at Windows PowerShell 1.0. But then, you are probably not actually using Windows 7 either, because Windows PowerShell 2.0 shipped with Windows 7.

This command and its associated output are shown here.

Image of command output

Run Windows Update

The first thing to do when getting ready to install anything is to run Windows Update. I go to Control Panel/Security and run Windows Update (after using Windows 8 for so long, this seems a bit strange). I am lucky the old laptop is basically up-to-date, and it only needs to install a single update as shown here.

Image of menu

When I am finished running Windows Update, I reboot the computer (even if it does not specifically request a reboot) because often laptops hibernate (or sleep0, and they go for weeks without a proper reboot.

Install the .NET Framework 4.0

Windows PowerShell 3.0 requires.NET Framework 4.0. If I do not install it first, and I try to install Windows PowerShell 3.0 without.NET Framework 4.0, a rather generic error appears: This update does not apply to your system. It is safest to install .NET Framework 4.0.

Find the correct download package

The easiest way to find the Windows PowerShell 3.0 download package is to access it directly from the Microsoft TechNet Script Center. I have a link to Windows PowerShell 3.0 under the Downloads section as shown in the following screenshot.

Image of menu

When I go to the Windows PowerShell 3.0 download page, I need to look at the Install Instructions to determine the correct version of the package to download. The download page is shown here:

Image of menu

In determining which version of the package to download, I also need to know the version of computer I have (for example, is it 64-bit or x86). I get this information from Windows PowerShell. The command I use is:

PS C:\Users\administrator> $env:PROCESSOR_ARCHITECTURE

x86

The available packages and the applicable operating system are listed here:

Windows 7 Service Pack 1

64-bit versions: Windows6.1-KB2506143-x64.msu

32-bit versions: Windows6.1-KB2506143-x86.msu

 

Windows Server 2008 R2 SP1

64-bit versions: Windows6.1-KB2506143-x64.msu

 

Windows Server 2008 Service Pack 2

64-bit versions: Windows6.0-KB2506146-x64.msu

32-bit versions: Windows6.0-KB2506146-x86.msu

After I know the version of the download package to obtain, I click the big red download button, and I am presented with a check box to select the version. I do this, click Next, and then tell it to run (rather than download and Save). 

After a few seconds, I am presented with the following message that asks if I want to apply the software update (KB2506143):

Image of message

Note   Make sure you have Windows PowerShell closed prior to performing the actual installation.

After accepting the License Terms, the update installs. It goes pretty fast.

When the installation completes, it requests a reboot. Following the reboot, Windows does a bit of configuration that will take a couple of minutes. The following screen displays during the configuration.

Image of message

Did it work?

Following the reboot, I sign in, and I want to immediately see if it worked. The first thing I do is open the Windows PowerShell console and type $psversiontable. The following data returns:

Image of command output

The last thing I want to do is to check out the new version of the Windows PowerShell ISE. Yep, it is all there: the new Command Add-On, the single Windows PowerShell console pane, the Click to run feature. Yep, it’s here and it ROCKS! This is shown here:

Image of menu

Well, the Scripting Guys booth looks cool, and I think it is time to head to the French Quarter and catch up with some PowerShell Tweeps. TechEd kicks off tomorrow bright and early, and it will be awesome! Hope to see you there.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Thank you as always for the detailed explantion!

  • @Ashok you are welcome. I am glad you like the article. Hope you find it helpful.

  • Don't forget to run Update-Help from an Administrator Powershell session so you can get all the latest (and awesome) help and examples on your machine. And for those who don't have external access, Save-Help works magnificently!

  • I received a "The update is not applicable to your computer." error when trying to install, and subsequently found the following link to make the install work properly.  Hope it helps!

    docs.google.com/.../edit

  • @Josh

    "The update is not applicable to your computer" appears because .NET Framework 4.0 is missing on your pre-Windows 8 system as mentioned in the article (although slightly different message "This update does not apply to your system").

    Thanks / rgds,

  • Great detailed articled. Worked like a charm.

  • Thank you, it worked.  one thing the command $spversiontable did not work.

  • Yes,  the instructions were very clear.  I also confirmed taht $psversion table does not work but I tried Get-Host | Select-Object Version  and it work.

    In addition if you want to confirm what version of Framework I had before the install, I used the commands below:

    ls $Env:windir\Microsoft.NET\Framework | ? { $_.PSIsContainer } | select -exp Name -l 1

    Thank you again!

  • Followed these instructions on 2 win7 machines. one worked as expected. The second worked, but lost all file associations. I can no longer right-click and select Run with PowerShell. I can no longer double click to Edit, or Open with.. there does not seem to be a way to do a repair to do the install again.. looking for some thoughts on how to fix this.

  • Does Powershell 3 install in its own set of folders, or does it overlay previous Powershell folders, i.e. 1.x, etc.

  • Its interesting that you have to check it worked. Windows is a closed platform, you pay for this. Shouldn't it just work? I would expect that Powershell would be a core part of Windows rather than an optional add-on that requires manual steps to install. How can you automate anything on Powershell when Powershell is a manual configuration?

  • Thanks for the detailed explanation! I upgraded PS 2.0 to 3.0 successfully on Win7 SP1 :-)

  • This is really strange for me to see a solution from scripting guy how to press buttons to install PowerShell 3.
    I expected to see a script which install powershell 3, not screens with the buttons.

  • It worked for me. Thanks for your help.

  • A moot point but Windows Powershell 2.0 was released for Windows XP Professional x86-x64.
    Installs Windows Powershell ISE also.