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:
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.
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.
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.
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:
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
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):
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.
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:
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:
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 firstname.lastname@example.org, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.
Ed Wilson, Microsoft Scripting Guy