{"id":75561,"date":"2015-12-22T00:01:00","date_gmt":"2015-12-22T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2015\/12\/22\/a-holiday-special-rusty-the-red-eyed-scripter-part-2\/"},"modified":"2019-02-18T09:20:35","modified_gmt":"2019-02-18T16:20:35","slug":"a-holiday-special-rusty-the-red-eyed-scripter-part-2","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/a-holiday-special-rusty-the-red-eyed-scripter-part-2\/","title":{"rendered":"A Holiday Special: Rusty the Red-Eyed Scripter, Part 2"},"content":{"rendered":"<p><b>Summary<\/b>: Rusty the Red-Eyed Scripter discovers how Windows PowerShell 5.0 can pull modules from a central repository.<\/p>\n<p align=\"left\"><strong>&nbsp; &nbsp;Note<\/strong> &nbsp;This is Part 2 in a five-part series. To get started, read <a href=\"https:\/\/devblogs.microsoft.com\/scripting\/a-holiday-special-rusty-the-red-eyed-scripter-part-1\/\" target=\"_blank\">Rusty the Red-Eyed Scripter, Part 1<\/a>.<\/p>\n<p>We return with Rusty sitting beside his new friend Thomas from Edmonton, all invigorated to check out Windows PowerShell 5.0.<\/p>\n<p>Rusty was quite interested in this PowerShell Saturday presentation about PowerShell 5 because it seems to offer a stronger level of ease-of-use from the PowerShell 1.0 version he had tried years ago.<\/p>\n<p>The speaker began discussing how PowerShell provides a new method to automatically find modules. Rusty was puzzled. &ldquo;I can find modules right now. I just go to Bing and search for them, then download the ones I want to my <b>Documents<\/b> folder,&rdquo; he mentioned to Thomas.<\/p>\n<p>Thomas smiled. &ldquo;&hellip;and what if there was a cmdlet in PowerShell that could not only find them but automatically download them and place them in a common path?&rdquo;<\/p>\n<p>Rusty&rsquo;s mouth dropped to the ground, &ldquo;Wwwwhhhhhaaaat??&rdquo;<\/p>\n<p>Thomas smiled a wry grin at his new friend, &ldquo;Listen to the next bit from the speaker and you&rsquo;ll see.&rdquo;<\/p>\n<p>The speaker (who tended to move about like a skittish squirrel) was talking all about the new PowerShell Gallery, a built-in module repository for PowerShell. He began to discuss the new cmdlets in the <b>PowerShellGet<\/b> module that comes with PowerShell 5.0.<\/p>\n<p>&ldquo;Our first cmdlet is called <b>Find-Module<\/b>. It reaches out to see all of the available modules in the PowerShell Gallery. This list of modules is presently populated by Microsoft staff and a select group of community individuals to maintain quality.&rdquo;<\/p>\n<p>The speaker showed the <b>Find-Module<\/b> cmdlet in action. &ldquo;For example, if I would like to find a module called <b>LocalAccount<\/b>, I can key in this command:&rdquo;<\/p>\n<p style=\"margin-left:30px\">Find-Module &ndash;name Localaccount<\/p>\n<p><a href=\"\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-76-18\/585475.1.PNG\"><img decoding=\"async\" src=\"\/resized-image.ashx\/__size\/550x0\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-76-18\/585475.1.PNG\" alt=\"Image of command output\" title=\"Image of command output\"><\/a><\/p>\n<p>&ldquo;If we&rsquo;d like to get a better view of the description, of course we can drop this into <b>Format-List<\/b>:&rdquo;<\/p>\n<p style=\"margin-left:30px\">Find-Module &ndash;name Localaccount | Format-List<\/p>\n<p><a href=\"\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-76-18\/5305.2.PNG\"><img decoding=\"async\" src=\"\/resized-image.ashx\/__size\/550x0\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-76-18\/5305.2.PNG\" alt=\"Image of command output\" title=\"Image of command output\"><\/a><\/p>\n<p>&ldquo;Afterwards, I can install it by specifying the name directly or simply piping the content to the <b>Install-Module<\/b> cmdlet.&rdquo;<\/p>\n<p style=\"margin-left:30px\">Find-Module &ndash;name Localaccount | Install-Module<\/p>\n<p>Rusty thought that was cool&mdash;except for the thought going through his head, &ldquo;But what if I don&rsquo;t know the name of the module? This assumes I know the name!&rdquo;<\/p>\n<p>Almost as if the speaker could somehow read his thoughts (or had some funky Jedi power), he began to speak the answer, &ldquo;But let&rsquo;s presume you don&rsquo;t know the module name. We can filter on the <b>Description<\/b> property and find all modules that might fit a particular description.&rdquo;<\/p>\n<p style=\"margin-left:30px\">Find-Module | Where { $_.Description &ndash;match &lsquo;local&rsquo; }<\/p>\n<p><a href=\"\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-76-18\/5810.3.PNG\"><img decoding=\"async\" src=\"\/resized-image.ashx\/__size\/550x0\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-76-18\/5810.3.PNG\" alt=\"Image of command output\" title=\"Image of command output\"><\/a><\/p>\n<p>The speaker continued, &ldquo;And because this is all PowerShell, I can run it through <b>Out-Gridview<\/b> to allow to me to cherry-pick the modules I want.&rdquo;<\/p>\n<p style=\"margin-left:30px\">Find-Module | Where { $_.Description &ndash;match &lsquo;local&rsquo; } | Out-Gridview &ndash;passthru | Install-Module<\/p>\n<p><a href=\"\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-76-18\/2330.4.PNG\"><img decoding=\"async\" src=\"\/resized-image.ashx\/__size\/550x0\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-76-18\/2330.4.PNG\" alt=\"Image of command output\" title=\"Image of command output\"><\/a><\/p>\n<p>Poor Rusty. When he saw this in action he almost fell out of his chair. Then the speaker simply clicked a module name and hit ENTER to install it directly on his computer.<\/p>\n<p>&ldquo;By the way,&rdquo; our skittish speaker went on, &ldquo;If you ever need to see if there is an updated version of a module, you can run the <b>Update-Module<\/b> cmdlet, for example:&rdquo;<\/p>\n<p style=\"margin-left:30px\">Update-Module &ndash;name localaccount<\/p>\n<p>As the presentation continued, the speaker discussed how it would not only work with the PowerShell Gallery, but it could also target many other repositories, including those for a company&rsquo;s internal sources.<\/p>\n<p>The speaker continued on by pointing out the work the community was doing directly with Microsoft on the GitHub repository.<\/p>\n<p>&ldquo;Waaaiit!&rdquo; Rusty looked at Thomas, &ldquo;Did I hear that right? GitHub is open source! Microsoft and open source solutions?&rdquo;<\/p>\n<p>&ldquo;Welcome to the real world, Neo,&rdquo; Thomas nudged his friend in the side, &ldquo;Things have changed in some amazing new ways!&rdquo;<\/p>\n<p>Rusty was itching to get out the door, but with so much more information about Windows PowerShell 5.0 available tonight, he dare not leave.<\/p>\n<p>&hellip;and just who was that mysterious fidgety speaker on stage?<\/p>\n<p>Stay tuned as tomorrow Rusty delves more into this wonderful land of Windows PowerShell 5.0.<\/p>\n<p>I invite you to follow the Scripting Guys 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 them 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, always remember that with great PowerShell comes great responsibility.<\/p>\n<p><b>Sean Kearney, <\/b>Honorary Scripting Guy, Cloud and Datacenter Management MVP<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Rusty the Red-Eyed Scripter discovers how Windows PowerShell 5.0 can pull modules from a central repository. &nbsp; &nbsp;Note &nbsp;This is Part 2 in a five-part series. To get started, read Rusty the Red-Eyed Scripter, Part 1. We return with Rusty sitting beside his new friend Thomas from Edmonton, all invigorated to check out Windows [&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":[642,56,154,45],"class_list":["post-75561","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-2015-holiday-series","tag-guest-blogger","tag-sean-kearney","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Rusty the Red-Eyed Scripter discovers how Windows PowerShell 5.0 can pull modules from a central repository. &nbsp; &nbsp;Note &nbsp;This is Part 2 in a five-part series. To get started, read Rusty the Red-Eyed Scripter, Part 1. We return with Rusty sitting beside his new friend Thomas from Edmonton, all invigorated to check out Windows [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/75561","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=75561"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/75561\/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=75561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=75561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=75561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}