{"id":2367,"date":"2013-12-23T00:01:00","date_gmt":"2013-12-23T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2013\/12\/23\/twas-the-night-before-scripting-part-3\/"},"modified":"2013-12-23T00:01:00","modified_gmt":"2013-12-23T00:01:00","slug":"twas-the-night-before-scripting-part-3","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/twas-the-night-before-scripting-part-3\/","title":{"rendered":"&#8216;Twas the Night Before Scripting: Part 3"},"content":{"rendered":"<p><b>Summary<\/b>: Dr. Scripto teaches our Admin friend how to find cmdlets in a module and get Help.<\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, here. If you missed it yesterday, see Sean&rsquo;s latest video:&nbsp;<a href=\"https:\/\/www.youtube.com\/watch?v=v8XuDXyt9YE&amp;feature=share&amp;list=UUQwtf2q4LnSyoVh4TNYFoNw\" target=\"_blank\">Just Script It<\/a>! Also be sure to read:&nbsp;<\/p>\n<ul>\n<li><a href=\"\/b\/heyscriptingguy\/archive\/2013\/12\/21\/twas-the-night-of-before-scripting-part-1.aspx\" target=\"_blank\">&lsquo;Twas the Night of Before Scripting: Part 1<\/a><\/li>\n<li><a href=\"\/b\/heyscriptingguy\/archive\/2013\/12\/22\/twas-the-night-before-scripting-part-2.aspx\" target=\"_blank\">&lsquo;Twas the Night of Before Scripting: Part 2<\/a><\/li>\n<\/ul>\n<p>Yesterday we saw how Dr. Scripto aided our good Administrator friend, a person who had never scripted, modify multiple users in Active Directory.&nbsp; Yet there was still much left to do on this project, including deployment of workstations, oh my!<\/p>\n<p>And so we continue with our third badly rhyme-filled session&hellip;<\/p>\n<p>And so it continued<\/p>\n<p>Yet not deep in the night,<\/p>\n<p>For PowerShell scripting<\/p>\n<p>Deleted the fright.<\/p>\n<p>&nbsp;<\/p>\n<p>With the good Dr. Scripto<\/p>\n<p>And our new Admin friend<\/p>\n<p>Learning to automate,<\/p>\n<p>His aid he would lend.<\/p>\n<p>&nbsp;<\/p>\n<p>He then looked at the list<\/p>\n<p>Of things left to do.<\/p>\n<p>Instead of a panic,<\/p>\n<p>A thought came anew.<\/p>\n<p>&nbsp;<\/p>\n<p>&ldquo;Dr. Scripto, a question,<\/p>\n<p>A query for you<\/p>\n<p>I wonder if PowerShell<\/p>\n<p>Could make this happen to?<\/p>\n<p>&nbsp;<\/p>\n<p>New accounts for computers<\/p>\n<p>I must create now.<\/p>\n<p>Is there a cmdlet or<\/p>\n<p>Some easy way how?&rdquo;<\/p>\n<p>&nbsp;<\/p>\n<p>The good Doctor smiled<\/p>\n<p>(Which was tricky, ya know,<\/p>\n<p>Since he is made of<\/p>\n<p>Plaster, not snow).<\/p>\n<p>&nbsp;<\/p>\n<p>He pulled a list of cmdlets<\/p>\n<p>From a module so keen,<\/p>\n<p>Active Directory it was called,<\/p>\n<p>Listed them all on the screen.<\/p>\n<p style=\"margin-left:30px\">Get-Command &ndash;module ActiveDirectory<\/p>\n<p>&nbsp;<\/p>\n<p>&ldquo;Hmm, perhaps I should show<\/p>\n<p>(Yes, that would make more sense)<\/p>\n<p>Only those for the computer,<\/p>\n<p>Would make it less dense&rdquo;<\/p>\n<p style=\"margin-left:30px\">Get-Command &ndash;name *Computer* &ndash;module ActiveDirectory<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/2742.1.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/2742.1.PNG\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a>&nbsp;<\/p>\n<p>&ldquo;Looking on screen<\/p>\n<p>At the list, oh so small,<\/p>\n<p>I see one that makes sense,<\/p>\n<p>Filling the call.&rdquo;<\/p>\n<p style=\"margin-left:30px\">New-ADComputer<\/p>\n<p>&nbsp;<\/p>\n<p>&ldquo;Dr. Scripto, but how&hellip;<\/p>\n<p>How can I know?<\/p>\n<p>To learn how to use<\/p>\n<p>The cmdlet below?&rdquo;<\/p>\n<p>&nbsp;<\/p>\n<p>With his bobbly head<\/p>\n<p>He bounced left and right,<\/p>\n<p>&ldquo;We use <b>Get-Help<\/b><\/p>\n<p>And <b>&ndash;examples<\/b> for sight.&rdquo;<\/p>\n<p style=\"margin-left:30px\">Get-Help New-ADComputer -examples<\/p>\n<p>&nbsp;<a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/2.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/2.PNG\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a>&nbsp;<\/p>\n<p>Our Admin smiled at the<\/p>\n<p>Sample he saw now,<\/p>\n<p>&ldquo;This seems all too simple!&rdquo;<\/p>\n<p>As he blinked and said, &ldquo;Wow!&rdquo;<\/p>\n<p>&nbsp;<\/p>\n<p>So then he typed<\/p>\n<p>Just for fun, in a way,<\/p>\n<p>A sample cmdlet<\/p>\n<p>To try it today.<\/p>\n<p style=\"margin-left:30px\">New-ADComputer &ndash;name &ldquo;JohnnyTestPC&rdquo; &ndash;SamAccountName &ldquo;JohnnyTestPC&rdquo;<\/p>\n<p>&nbsp;<\/p>\n<p>And checking the results<\/p>\n<p>Within the MMC,<\/p>\n<p>Our Admin could view<\/p>\n<p>His success for to see.<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/3.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/3.PNG\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a>&nbsp;<\/p>\n<\/p>\n<p>&ldquo;Creating accounts<\/p>\n<p>For over 500 PCs<\/p>\n<p>Might not be so hard<\/p>\n<p>With this cmdlet for me!&rdquo;<\/p>\n<p>&nbsp;<\/p>\n<p>Dr. Scripto bobbed Yes<\/p>\n<p>And jumped up and down,<\/p>\n<p>Our Admin now had a smile<\/p>\n<p>Instead of a frown.<\/p>\n<p>&nbsp;<\/p>\n<p>And tomorrow we&rsquo;ll<\/p>\n<p>See how he&rsquo;ll fare,<\/p>\n<p>On setting up systems<\/p>\n<p>With security to fare!<\/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 <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>Sean Kearney<\/b>, Honorary Scripting Guy and Windows PowerShell MVP<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Dr. Scripto teaches our Admin friend how to find cmdlets in a module and get Help. Microsoft Scripting Guy, Ed Wilson, here. If you missed it yesterday, see Sean&rsquo;s latest video:&nbsp;Just Script It! Also be sure to read:&nbsp; &lsquo;Twas the Night of Before Scripting: Part 1 &lsquo;Twas the Night of Before Scripting: Part 2 [&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":[56,154,45],"class_list":["post-2367","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-guest-blogger","tag-sean-kearney","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Dr. Scripto teaches our Admin friend how to find cmdlets in a module and get Help. Microsoft Scripting Guy, Ed Wilson, here. If you missed it yesterday, see Sean&rsquo;s latest video:&nbsp;Just Script It! Also be sure to read:&nbsp; &lsquo;Twas the Night of Before Scripting: Part 1 &lsquo;Twas the Night of Before Scripting: Part 2 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/2367","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=2367"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/2367\/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=2367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=2367"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=2367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}