{"id":86036,"date":"2015-12-22T07:51:51","date_gmt":"2015-12-22T15:51:51","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/scripting\/?p=86036"},"modified":"2019-06-12T08:30:49","modified_gmt":"2019-06-12T16:30:49","slug":"a-holiday-special-rusty-the-red-eyed-scripter-part-2-2","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/a-holiday-special-rusty-the-red-eyed-scripter-part-2-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><b>&nbsp; Note<\/b>&nbsp;&nbsp;&nbsp;This is a five-part series that includes the following posts:<\/p>\n<ul>\n<li><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><br \/>Rusty discovers compressing files and working with the Clipboard&nbsp;<\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/scripting\/a-holiday-special-rusty-the-red-eyed-scripter-part-2\/\" target=\"_blank\">Rusty the Red-Eyed Scripter, Part 2<\/a><br \/>Rusty discovers how Windows PowerShell 5.0 can pull modules from a central repository<\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/scripting\/a-holiday-special-rusty-the-red-eyed-scripter-part-3\/\" target=\"_blank\">Rusty the Red-Eyed Scripter, Part 3<\/a><br \/>Rusty learns how to unblock files and tweak event logs&nbsp;<\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/scripting\/a-holiday-special-rusty-the-red-eyed-scripter-part-4\/\" target=\"_blank\">Rusty the Red-Eyed Scripter, Part 4<\/a><br \/>Rusty learns how PowerShell can convert raw string data to an object<\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/scripting\/a-holiday-special-rusty-the-red-eyed-scripter-part-5\/\" target=\"_blank\">Rusty the Red-Eyed Scripter, Part 5<\/a><br \/>Rusty discovers the power of classes and enums&nbsp;<\/li>\n<\/ul>\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=\"http:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2015\/12\/585475.1.png\"><img decoding=\"async\" src=\"http:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2015\/12\/585475.1.png\" alt=\"image of command output\" width=\"628\" height=\"41\" class=\"aligncenter size-full wp-image-86038\" srcset=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2015\/12\/585475.1.png 628w, https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2015\/12\/585475.1-300x20.png 300w\" sizes=\"(max-width: 628px) 100vw, 628px\" \/><\/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=\"http:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2015\/12\/5305.2.png\"><img decoding=\"async\" src=\"http:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2015\/12\/5305.2.png\" alt=\"image of command output\" width=\"619\" height=\"91\" class=\"aligncenter size-full wp-image-86040\" srcset=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2015\/12\/5305.2.png 619w, https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2015\/12\/5305.2-300x44.png 300w\" sizes=\"(max-width: 619px) 100vw, 619px\" \/><\/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=\"http:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2015\/12\/5810.3.png\"><img decoding=\"async\" src=\"http:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2015\/12\/5810.3.png\" alt=\"image of command output\" width=\"629\" height=\"253\" class=\"aligncenter size-full wp-image-86041\" srcset=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2015\/12\/5810.3.png 629w, https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2015\/12\/5810.3-300x121.png 300w\" sizes=\"(max-width: 629px) 100vw, 629px\" \/><\/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=\"http:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2015\/12\/2330.4.png\"><img decoding=\"async\" src=\"http:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2015\/12\/2330.4.png\" alt=\"image of command output\" width=\"623\" height=\"285\" class=\"aligncenter size-full wp-image-86042\" srcset=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2015\/12\/2330.4.png 623w, https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2015\/12\/2330.4-300x137.png 300w\" sizes=\"(max-width: 623px) 100vw, 623px\" \/><\/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>\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; Note&nbsp;&nbsp;&nbsp;This is a five-part series that includes the following posts: Rusty the Red-Eyed Scripter, Part 1Rusty discovers compressing files and working with the Clipboard&nbsp; Rusty the Red-Eyed Scripter, Part 2Rusty discovers how Windows PowerShell 5.0 can pull [&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":[],"class_list":["post-86036","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting"],"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; Note&nbsp;&nbsp;&nbsp;This is a five-part series that includes the following posts: Rusty the Red-Eyed Scripter, Part 1Rusty discovers compressing files and working with the Clipboard&nbsp; Rusty the Red-Eyed Scripter, Part 2Rusty discovers how Windows PowerShell 5.0 can pull [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/86036","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=86036"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/86036\/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=86036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=86036"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=86036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}