Weekend Scripter: Exploring Windows PowerShell 5.0

Summary: Teresa Wilson, Powershell MVP, talks about exploring Windows PowerShell 5.0 on Windows 10.

Teresa Wilson, AKA the Scripting Wife, is here. The Microsoft Scripting Guy, Ed Wilson, is still missing in action. He downloaded Windows 10, and I haven’t seen him since. So I thought I would write about getting Windows PowerShell 5.0 running on Windows 10.

The first thing I need to do is find Windows PowerShell 5.0. I type PowerShell in the Web and Windows search box on my task bar. Cortana comes up and locates the Windows PowerShell 5.0 executable. I click the top of the list for the Desktop app, and Windows PowerShell opens. It opens with the working directory in my profile, but with a shortened version of my logon name. It says Users\Scrip as my directory. Cool enough. Here is the menu from Cortana:

Image of menu

I know I need to update Help. I type Update-Help –module * -Force. The Windows PowerShell progress hums along and it appears to work. Suddenly I am looking at the following long list of error messages:

Image of messages

It is a lot of red, but about half way down, it provides the reason why. I need to run Windows PowerShell as an Administrator, and then try the command again. Once again Cortana and I meet.

This time, I right-click Windows PowerShell, select Run as Administrator, and try the command again. This time, there is only an error message about one of the modules that does not have updatable Help. Cool, it worked.

I again close the Windows PowerShell Admin console. This time when I type PowerShell, I right-click PowerShell and select Pin to Start. I again right-click PowerShell and select Pin to Taskbar. This is shown here:

Image of menu

Sweet. Now I don’t have to mess around searching for a program that I know I will use all the time.

I want to see what I have in Windows PowerShell 5.0. I use the Get-Command cmdlet (gcm is an alias), and I count the number of cmdlets that return. I then decide to group the commands by version of the module. This is shown here:

Image of command output

There are 1285 cmdlets, and of these, 20 are in a module with the version of 3.3.5, and 191 of them are in a module version Now I decide to sort them by the number of cmdlets in each module. To do this, I keep building my command. I get all of the commands from all modules and then sort by module. I then group by module and sort the results by the number of commands in each module. I do a descending sort. I then send the format to Format-Table and choose the name and count. Here is my command:

gcm -Module * | sort Module | group module | sort count -Descending | ft name, count

The command and output from the command are shown here:

Image of command output

I continue to look at modules by looking at the cmdlets in each module. Here is an example of such a command:

gcm -Module PKI

I will let you go play. Time to see where that script monkey wandered off to. Hope you have a great weekend.


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 

Comments (0)

Skip to main content