{"id":71782,"date":"2015-08-02T00:01:00","date_gmt":"2015-08-02T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2015\/08\/02\/weekend-scripter-exploring-windows-powershell-5-0\/"},"modified":"2019-02-18T09:46:45","modified_gmt":"2019-02-18T16:46:45","slug":"weekend-scripter-exploring-windows-powershell-5-0","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/weekend-scripter-exploring-windows-powershell-5-0\/","title":{"rendered":"Weekend Scripter: Exploring Windows PowerShell 5.0"},"content":{"rendered":"<p><b style=\"font-size:12px\">Summary<\/b><span style=\"font-size:12px\">: Teresa Wilson, Powershell MVP, talks about exploring Windows PowerShell 5.0 on Windows 10.<\/span><\/p>\n<p>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&rsquo;t seen him since. So I thought I would write about getting Windows PowerShell&nbsp;5.0 running on Windows 10.<\/p>\n<p>The first thing I need to do is find Windows PowerShell&nbsp;5.0. I type <b>PowerShell<\/b> in the Web and Windows search box on my task bar. Cortana comes up and locates the Windows PowerShell&nbsp;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:<\/p>\n<p style=\"margin-left:30px\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/Hsg-8-2-15-01.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/Hsg-8-2-15-01.png\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>I know I need to update Help. I type <b>Update-Help &ndash;module * -Force<\/b>. The Windows PowerShell progress hums along and it appears to work. Suddenly I am looking at the following long list of error messages:<\/p>\n<p style=\"margin-left:30px\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/Hsg-8-2-15-02.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/Hsg-8-2-15-02.png\" alt=\"Image of messages\" title=\"Image of messages\" \/><\/a><\/p>\n<p>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.<\/p>\n<p>This time, I right-click <b>Windows PowerShell<\/b>, select <b>Run as Administrator<\/b>, 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.<\/p>\n<p>I again close the Windows PowerShell Admin console. This time when I type <b>PowerShell<\/b>, I right-click <b>PowerShell<\/b> and select <b>Pin to Start<\/b>. I again right-click <b>PowerShell<\/b> and select <b>Pin to Taskbar<\/b>. This is shown here:<\/p>\n<p style=\"margin-left:30px\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/Hsg-8-2-15-03.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/Hsg-8-2-15-03.png\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>Sweet. Now I don&rsquo;t have to mess around searching for a program that I know I will use all the time.<\/p>\n<p>I want to see what I have in Windows PowerShell&nbsp;5.0. I use the <b>Get-Command<\/b> cmdlet (<b>gcm<\/b> 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:<\/p>\n<p style=\"margin-left:30px\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/Hsg-8-2-15-04.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/Hsg-8-2-15-04.png\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>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 3.1.0.0. 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 <b>Format-Table<\/b> and choose the name and count. Here is my command:<\/p>\n<p style=\"margin-left:30px\">gcm -Module * | sort Module | group module | sort count -Descending | ft name, count<\/p>\n<p>The command and output from the command are shown here:<\/p>\n<p style=\"margin-left:30px\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/Hsg-8-2-15-05.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/Hsg-8-2-15-05.png\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>I continue to look at modules by looking at the cmdlets in each module. Here is an example of such a command:<\/p>\n<p style=\"margin-left:30px\">gcm -Module PKI<\/p>\n<p>I will let you go play. Time to see where that script monkey wandered off to. Hope you have a great weekend.<\/p>\n<p>~Teresa<\/p>\n<p>I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><b>Ed Wilson, Microsoft Scripting Guy<\/b><span style=\"font-size:12px\">&nbsp;<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&rsquo;t seen him since. So I thought I would write about getting Windows PowerShell&nbsp;5.0 running on [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[191,56,609,3,337,61,45],"class_list":["post-71782","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-community","tag-guest-blogger","tag-powershell-5","tag-scripting-guy","tag-teresa-wilson","tag-weekend-scripter","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>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&rsquo;t seen him since. So I thought I would write about getting Windows PowerShell&nbsp;5.0 running on [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/71782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=71782"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/71782\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=71782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=71782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=71782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}