Moving to PowerShell 5.0

Because I do so much training and work in PowerShell 4.0, primarily because I think many people are still running 4.0, I’m always behind in upgrading to newer versions of PowerShell. With that said, I think I’ve finally reached a point where it makes sense to move to PowerShell 5.0 on my daily system. In this article, I’ll walk through some essential steps to take after moving to PowerShell 5.0.

My system is still running Windows 8.1 Enterprise, and while I could have upgraded it to Windows 10 to get PowerShell 5.0, I wasn’t ready to make that change due to some potential application issues. I have another system running Windows 10, so I’m not totally out of step.

Technically, PowerShell 5.0 is part of the Windows Management Framework 5.0. Note that the the Windows Management Framework 5.0 RTM release was released on December 23, 2015, but the update was taken offline due to customer issues. In the meantime, you can still download the production preview to get started. You will need to be running at least Windows 7 SP1 and the .NET Framework 4.5. If you’re installing on a server, be sure to read the install notes.

To upgrade, close all PowerShell and PowerShell ISE windows. As with any major installation, make sure you have backups of critical files. The update shouldn’t cause any problems, but better safe than sorry. Navigate to the downloaded files and double-click the MSU file for your operating system. Follow the simple instructions and reboot when prompted. The entire upgrade goes pretty quickly.

Sponsored Content

Devolutions Remote Desktop Manager

Devolutions RDM centralizes all remote connections on a single platform that is securely shared between users and across the entire team. With support for hundreds of integrated technologies — including multiple protocols and VPNs — along with built-in enterprise-grade password management tools, global and granular-level access controls, and robust mobile apps to complement desktop clients.

Upon reboot, I opened up a PowerShell window and confirmed the new version.

Verifying the new version (Image Credit: Jeff Hicks)
Verifying the new version (Image Credit: Jeff Hicks)

Although I’m running PowerShell 5.0, I’m still running Windows 8.1, so I don’t get new things like the improved console window that we get in Windows 10. As far as I can tell, the PowerShell ISE is unchanged except for new version numbers.

The first step is to update help, primarily because there are a number of new cmdlets.

Need new help (Image Credit: Jeff Hicks)
Need new help (Image Credit: Jeff Hicks)

As in PowerShell 4.0, all you need to do is run Update-Help. You might see an error or two for modules like OneGet. That’s normal. Unfortunately, even with updating, some cmdlets are lacking help documentation both in help and online. At some point, I hope that documentation catches up. Still, it doesn’t hurt to run Update-Help.

When you downloaded the 5.0 files, you should also have pulled down a Word document with extensive release notes. I hope you take a lunch break to skim through it. You should also read the help topic about_Windows_PowerShell_5.0.

What do you get for all this effort? A new package management system with PowerShellGet, improvements to Desired State Configuration (DSC), new debugging tools, new cmdlets, and additional parameters.

I have a pretty extensive PowerShell profile and when I started up PowerShell, everything ran without error, so that’s a positive. Over the next few weeks, I’ll be testing a number of my scripts and tools for any bugs or incompatibilities with PowerShell 5.0. But so far, so good.

The first thing I’m going to do in this new world is try out the package manager tools, which is probably one of the more intriguing features. By default, you have access to a Microsoft repository of modules.

Getting the PowerShell Gallery repository (Image Credit: Jeff Hicks)
Getting the PowerShell Gallery repository (Image Credit: Jeff Hicks)

I want to see what’s available.

First step in finding modules online (Image Credit: Jeff Hicks)
First step in finding modules online (Image Credit: Jeff Hicks)

Because I’ve never used the cmdlet before, I need to download an additional file. Now I can rerun the Find-Module command.

Finding modules (Image Credit: Jeff Hicks)
Finding modules (Image Credit: Jeff Hicks)

I found almost 400 modules, many of them are DSC resources. It’s easy enough to pipe $m to Out-Gridview to see the results.

Available modules (Image Credit: Jeff Hicks)
Available modules (Image Credit: Jeff Hicks)

In scrolling through the list, I see a number of things I’d like to have, so I’ll get one.

Installing a module (Image Credit: Jeff Hicks)
Installing a module (Image Credit: Jeff Hicks)

At some point, I’ll modify the trust settings for the PowerShell Gallery, but for now, I can say yes.

Viewing the new module

This also shows up now as an installed module:

Viewing installed modules (Image Credit: Jeff Hicks)
Viewing installed modules (Image Credit: Jeff Hicks)

Eventually I can use Update-Module to get the latest version.

This is just a taste of what awaits you. I’m looking forward to getting to know PowerShell 5.0 on a more intimate level.

What’s your story? Have you moved to PowerShell 5.0? If not, what’s holding you back? I’d love to hear about it.

Related Topics:


Don't have a login but want to join the conversation? Sign up for a Petri Account

Comments (0)

Leave a Reply

The World’s Most Comprehensive Teams to Teams Migration Checklist

Whether you have just started thinking about migration or have already begun to move, our Microsoft Teams Migration Checklist can help guide you through the different phases for a Teams migration to another tenant.

This detailed six-step guide will walk you through key decision points while also providing more prescriptive best practice recommendations where appropriate.

Discover key insights for the following phases of a Teams migration: 

  • Discovery
  • Pilot
  • Planning
  • Communication
  • Execution
  • Validation

Sponsored by: