{"id":83298,"date":"2018-09-15T00:00:50","date_gmt":"2018-09-15T07:00:50","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/scripting\/?p=83298"},"modified":"2019-02-18T09:09:52","modified_gmt":"2019-02-18T16:09:52","slug":"powertip-use-powershell-to-pick-a-random-name-from-a-list","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/powertip-use-powershell-to-pick-a-random-name-from-a-list\/","title":{"rendered":"PowerTip: Use PowerShell to pick a random name from a list"},"content":{"rendered":"<p><strong>Summary<\/strong>: Using the Get-Random Cmdlet to select a random list of names instead of numbers<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-82735\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"\" width=\"34\" height=\"34\" \/><\/a>Hey! Dr. Scripto!<\/p>\n<p>I\u2019d like to pick a random name from a list to generate user names in my lab.\u00a0\u00a0 Could you show me an example?<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-82745\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"\" width=\"34\" height=\"34\" \/><\/a><\/p>\n<p>I\u2019d be delighted to.\u00a0\u00a0 Just use an array of names and then add them as a parameter to Get-Random.\u00a0\u00a0 You could even pipe it to Get-Random if you liked as well.<\/p>\n<p><strong>$NameList=&#8217;John&#8217;,&#8217;Charlotte&#8217;,&#8217;Sean&#8217;,&#8217;Colleen&#8217;,&#8217;Namoli&#8217;,&#8217;Maura&#8217;,&#8217;Neula&#8217;<\/strong><\/p>\n<p><strong>Get-Random -InputObject $NameList<\/strong><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/dr_scripto.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-82775\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/dr_scripto.png\" alt=\"Drawing of Dr. Scripto\" width=\"96\" height=\"145\" \/><\/a><\/p>\n<p>Windows PowerShell, Sean Kearney, Scripting Guy, PowerTip<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using the Get-Random Cmdlet to select a random list of names instead of numbers<\/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":[568,639,685],"tags":[356,3,154,45],"class_list":["post-83298","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hey-scripting-guy","category-powertip","category-scripting-techniques","tag-powertip","tag-scripting-guy","tag-sean-kearney","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Using the Get-Random Cmdlet to select a random list of names instead of numbers<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/83298","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=83298"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/83298\/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=83298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=83298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=83298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}