{"id":5641,"date":"2017-09-13T13:02:29","date_gmt":"2017-09-13T17:02:29","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=5641"},"modified":"2017-09-13T13:02:29","modified_gmt":"2017-09-13T17:02:29","slug":"powershell-pop-quiz","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/","title":{"rendered":"PowerShell Pop Quiz"},"content":{"rendered":"<p>I'm always looking for ways to help teach PowerShell and the other day I thought why not have PowerShell teach you itself? I have created a PowerShell script that dynamically generates a quiz on cmdlets and functions installed on your computer. In short the quiz question shows you a command synopsis and then presents a menu of possible answers. You select the answer. Given the verb-noun pattern of command names this *should* be easy, but you might be surprised.<\/p>\n<p><!--more--><\/p>\n<p>Right now, the quiz comes in a stand-alone script. At some point I'll most likely add it to my PSTeachingTools module which you can install from the PowerShell Gallery. The script has help so after you download it you can get it:<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">help C:\\scripts\\PSquiz.ps1 -full\r\n<\/pre>\n<p>By default the script will find all cmdlets and functions from modules installed on your computer that have a properly defined synopsis. I've tried to include some filtering to handle buggy commands or those that have no help. You can also exclude one or more modules and wild cards are allowed. Or, you can specify a specific module. After the script builds a cache of commands it autogenerates a question and prompts you for an answer:<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/09\/image.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/09\/image_thumb.png\" alt=\"image\" width=\"1018\" height=\"517\" border=\"0\" \/><\/a><\/p>\n<p>If you answer wrong, the script will display the correct answer. To continue with another question, press any key. The script will keep track of your progress and when you eventually quit, display a color coded summary result.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/09\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/09\/image_thumb-1.png\" alt=\"image\" width=\"1028\" height=\"531\" border=\"0\" \/><\/a><\/p>\n<p>For now, you can find the script here.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">#requires -version 5.0\r\n\r\n#PSQuiz.ps1\r\n\r\n&lt;#\r\n.Synopsis\r\nRun a PowerShell quiz\r\n.Description\r\nUse this script to test your knowledge of PowerShell commands, which given the Verb-Noun naming pattern should be pretty easy.\r\n\r\nThe default behavior is to use all cmdlets and functions from installed modules with an option to exclude an array of module names. Wildcards are allowed. You also have the option to specify a single module for testing.\r\n.Example\r\nPS C:\\&gt; c:\\scripts\\PSQuiz.ps1\r\n\r\nPowerShell Pop Quiz\r\n\r\nGiven this short cmdlet description:\r\n\r\n Creates a new System.Windows.Markup.RoutedEventConverter\r\n\r\n What command would you use?\r\n\r\n  [1]   Invoke-CauScan\r\n  [2]   Clear-Tpm\r\n  [3]   Remove-WindowsCapability\r\n  [4]   Get-IscsiTargetServerSetting\r\n  [5]   New-RoutedEventConverter\r\n\r\nSelect a menu choice [1-5]: 5\r\n\r\nYou are Correct!!\r\n\r\nDo you want another question? Press any key to continue or Q to quit: q\r\nYour scored 1 correct out of 1 [100.00 %]\r\n.Example\r\nPS C:\\&gt; c:\\scripts\\PSQuiz.ps1 -module Hyper-V\r\n\r\nLaunch the quiz but only use commands from the Hyper-V module.\r\n\r\n.Example\r\nPS C:\\&gt; c:\\scripts\\PSQuiz.ps1 -exclude ISE,WPK,my*\r\n\r\nLaunch the quiz using all modules except ISE, WPK and any modules that start with 'my'.\r\n.Link\r\nGet-Help\r\n.Link\r\nGet-Command\r\n.Notes\r\nVersion 0.9\r\n\r\nLearn more about PowerShell:\r\n<blockquote class=\"wp-embedded-content\" data-secret=\"RRgky4JCYl\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/essential-powershell-resources\/\">Essential PowerShell Learning Resources<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Essential PowerShell Learning Resources&#8221; &#8212; The Lonely Administrator\" src=\"https:\/\/jdhitsolutions.com\/blog\/essential-powershell-resources\/embed\/#?secret=jSfIcdRc5m#?secret=RRgky4JCYl\" data-secret=\"RRgky4JCYl\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\r\n\r\n\r\n#&gt;\r\n[cmdletbinding(DefaultParameterSetName = \"all\")]\r\nParam(\r\n    [Parameter(ParameterSetName = \"single\")]    \r\n    [ValidateScript( {Get-Module $_ -list})]\r\n    #You can specify a single module for testing. The default is all modules.\r\n    [string]$ModuleName,\r\n    [Parameter(ParameterSetName = \"all\")]\r\n    #Enter a comma separated list of module names to ignore. You can use wildcards.\r\n    [string[]]$Exclude,\r\n    #This is used to indicate a continuing test. You should never need to use this parameter.\r\n    [switch]$NextQuestion\r\n)\r\n\r\nClear-Host\r\nWrite-Verbose \"Starting $($myinvocation.MyCommand)\"\r\nWrite-Verbose \"PSBoundparameters:\"\r\nwrite-verbose ($psboundparameters | out-string)\r\n\r\nif (-Not $NextQuestion) {\r\n    Write-Verbose \"First question setup\"\r\n    #initialize some variables to keep track of correct answers\r\n    $global:QuestionCount = 0\r\n    $global:CorrectCount = 0\r\n    $global:CommandCache = @()\r\n\r\n    if ($ModuleName) {\r\n        $Status = \"Getting commands from module $modulename.\"\r\n        Write-Verbose $Status\r\n        Write-Progress -Activity $myinvocation.MyCommand -Status $status -CurrentOperation \"Please wait...\"\r\n        $global:CommandCache = Get-command -CommandType Cmdlet,Function -Module $ModuleName   \r\n        \r\n    }\r\n    else {\r\n        $status = \"Getting commands from all available modules.\"\r\n\r\n        if ($exclude) {\r\n            $status += \" Excluding these modules: $($exclude -join ',') \"\r\n            #define a separate filter because this causes a problem in PowerShell v6 if $exclude is not specified\r\n            $filter = {$_.Source -AND $_.source -notmatch $($exclude -join '|')}\r\n        }\r\n        else {\r\n            $filter = {$_.Source}\r\n        }\r\n        Write-Verbose $status\r\n        Write-Progress -Activity $myinvocation.MyCommand -Status $status -CurrentOperation \"Please wait...\"\r\n        #get cmdlets and function that have a defined source which should be a module or snapin\r\n        $global:CommandCache = (Get-command -CommandType Cmdlet,Function).Where($filter)\r\n    }\r\n    Write-Progress -Activity  $myinvocation.MyCommand -Completed\r\n    Write-Verbose \"Added $(($global:commandCache).count) commands to the command cache\"\r\n    if ((($global:commandCache).count) -eq 0) {\r\n        Write-Warning \"Failed to find commands in any matching modules.\"\r\n        #bail out\r\n        Return\r\n    }\r\n}\r\nelse {\r\n    Write-Verbose \"Continuing the quiz\"\r\n    Write-Verbose \"Current question count: $($global:QuestionCount)\"\r\n    Write-Verbose \"Current correct count: $($global:CorrectCount)\"\r\n    Write-Verbose \"Current command cache: $(($global:commandCache).count)\"\r\n}\r\n\r\n#select a random command with a legitimate synopsis\r\nWrite-Verbose \"Selecting a random command\"\r\ndo {\r\n    $cmd = $global:CommandCache | Get-Random\r\n    $synopsis = ($cmd | Get-Help).synopsis\r\n\r\n} until ($synopsis -notmatch \"(This cmdlet is not supported)|\\[|(Fill in the Synopsis)\" -AND $synopsis -match \"\\w{4,}\")\r\n\r\n#get other noun related commands\r\n[object[]]$commands = @($cmd)\r\n$commands += get-command -noun $cmd.noun | Where-Object {$_.name -ne $cmd.name} | Select-Object -first 4\r\n\r\n#get additional random commands if there are not enough noun-related\r\nif ($commands.count -lt 5) {\r\n    Write-Verbose \"Getting supplemental commands for answers\"\r\n    While ($commands.count -lt 5) {\r\n        $add = Get-command -CommandType Cmdlet | Get-Random |\r\n            Where-Object {$commands.name -notcontains $_.name}\r\n        $commands += $add\r\n    }\r\n}\r\n#randomize\r\n$commands = $commands | get-random -count $commands.count\r\n\r\n$Title = \"PowerShell Pop Quiz\"\r\n$Cue = @\"\r\n\r\nGiven this short cmdlet description: \r\n\r\n $synopsis\r\n\r\n What command would you use?\r\n\r\n\r\n\"@\r\n\r\nfor ($i = 1; $i -lt $commands.count + 1; $i++) {\r\n\r\n    $Cue += \"  [$i]`t$($commands[$i-1].Name)`n\"\r\n}\r\n\r\nWrite-host $Title -ForegroundColor Cyan\r\nWrite-Host $Cue -ForegroundColor Yellow\r\n\r\nDo {\r\n    try {\r\n        [validaterange(1, 5)][int32]$r = Read-Host -prompt \"Select a menu choice [1-5]\" -erroraction stop\r\n        write-verbose \"You entered $r\"\r\n    }\r\n    Catch {\r\n        #ignore the error\r\n        write-warning $_.exception.message\r\n        $r = 0\r\n    }\r\n} Until ($r -ge 1 -AND $r -le 5)\r\n\r\n#increment the question counter\r\n$global:QuestionCount++\r\nif ($commands[$r - 1].name -eq $cmd.Name) {\r\n    $global:CorrectCount++\r\n    Write-Host \"`nYou are Correct!!\" -foregroundcolor green\r\n}\r\nelse {\r\n    Write-Host \"`nThe correct answer is $($cmd.name)\" -foregroundcolor Red\r\n}\r\n\r\n[string]$s = Read-Host \"`nDo you want another question? Press any key to continue or Q to quit\"\r\nif ($s -match \"^q\") {\r\n    $score = ($global:CorrectCount \/ $global:QuestionCount)\r\n    $result = \"Your scored {0} correct out of {1} [{2:p2}]\" -f $global:CorrectCount, $global:QuestionCount, $score\r\n    #colorize output based on score\r\n    if ($score -ge .80) {\r\n        $fg = \"green\"\r\n    }\r\n    elseif ($score -ge .40) {\r\n        $fg = \"yellow\"\r\n    }\r\n    else {\r\n        $fg = \"red\"\r\n    }\r\n    Write-Host $result -ForegroundColor $fg\r\n    Remove-Variable CorrectCount, QuestionCount,CommandCache -Scope global\r\n} \r\nelse {\r\n    if (-Not ($psboundParameters.containsKey(\"NextQuestion\"))) {\r\n            Write-Verbose \"Flagging for next question\"\r\n            $psboundparameters.add(\"NextQuestion\", $True)\r\n        }\r\n        Write-Verbose \"Invoking quiz\"\r\n        #Write-verbose ($myinvocation.mycommand | out-string)\r\n        &amp;$($myinvocation.mycommand) @PSBoundParameters\r\n        \r\n    }\r\n<\/pre>\n<p>I hope you'll give it a shot and if you get errors, let me know. Also interested in any enhancements that would make this more useful. I have a few in mind already but I'd like to get some feedback on the core functionality.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m always looking for ways to help teach PowerShell and the other day I thought why not have PowerShell teach you itself? I have created a PowerShell script that dynamically generates a quiz on cmdlets and functions installed on your computer. In short the quiz question shows you a command synopsis and then presents a&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"New on the blog: #PowerShell Pop Quiz","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,9],"tags":[534,540,542],"class_list":["post-5641","post","type-post","status-publish","format-standard","hentry","category-powershell","category-training","tag-powershell","tag-scripting","tag-training"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PowerShell Pop Quiz &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PowerShell Pop Quiz &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I&#039;m always looking for ways to help teach PowerShell and the other day I thought why not have PowerShell teach you itself? I have created a PowerShell script that dynamically generates a quiz on cmdlets and functions installed on your computer. In short the quiz question shows you a command synopsis and then presents a...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2017-09-13T17:02:29+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/09\/image_thumb.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5641\\\/powershell-pop-quiz\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5641\\\/powershell-pop-quiz\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"PowerShell Pop Quiz\",\"datePublished\":\"2017-09-13T17:02:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5641\\\/powershell-pop-quiz\\\/\"},\"wordCount\":295,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5641\\\/powershell-pop-quiz\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/09\\\/image_thumb.png\",\"keywords\":[\"PowerShell\",\"Scripting\",\"Training\"],\"articleSection\":[\"PowerShell\",\"Training\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5641\\\/powershell-pop-quiz\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5641\\\/powershell-pop-quiz\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5641\\\/powershell-pop-quiz\\\/\",\"name\":\"PowerShell Pop Quiz &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5641\\\/powershell-pop-quiz\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5641\\\/powershell-pop-quiz\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/09\\\/image_thumb.png\",\"datePublished\":\"2017-09-13T17:02:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5641\\\/powershell-pop-quiz\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5641\\\/powershell-pop-quiz\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5641\\\/powershell-pop-quiz\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/09\\\/image_thumb.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/09\\\/image_thumb.png\",\"width\":1018,\"height\":517},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5641\\\/powershell-pop-quiz\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PowerShell Pop Quiz\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PowerShell Pop Quiz &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/","og_locale":"en_US","og_type":"article","og_title":"PowerShell Pop Quiz &#8226; The Lonely Administrator","og_description":"I'm always looking for ways to help teach PowerShell and the other day I thought why not have PowerShell teach you itself? I have created a PowerShell script that dynamically generates a quiz on cmdlets and functions installed on your computer. In short the quiz question shows you a command synopsis and then presents a...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/","og_site_name":"The Lonely Administrator","article_published_time":"2017-09-13T17:02:29+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/09\/image_thumb.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"PowerShell Pop Quiz","datePublished":"2017-09-13T17:02:29+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/"},"wordCount":295,"commentCount":2,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/09\/image_thumb.png","keywords":["PowerShell","Scripting","Training"],"articleSection":["PowerShell","Training"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/","name":"PowerShell Pop Quiz &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/09\/image_thumb.png","datePublished":"2017-09-13T17:02:29+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/09\/image_thumb.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/09\/image_thumb.png","width":1018,"height":517},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5641\/powershell-pop-quiz\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"PowerShell Pop Quiz"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":555,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/555\/profiling-a-script\/","url_meta":{"origin":5641,"position":0},"title":"Profiling a Script","author":"Jeffery Hicks","date":"January 14, 2010","format":false,"excerpt":"Last summer, Ed Wilson was looking for help with a small part of the book he was finishing up, Windows PowerShell 2.0 Best Practices. The topic he was working on was, \u201cHow do I know this script is safe to run?\u201d Which is a great question and one with greater\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":634,"url":"https:\/\/jdhitsolutions.com\/blog\/best-practices\/634\/content-redirection\/","url_meta":{"origin":5641,"position":1},"title":"Content Redirection","author":"Jeffery Hicks","date":"May 3, 2010","format":false,"excerpt":"Here\u2019s another item I see in some submisstions of the 2010 Scripting Games that I felt I should address: the use of legacy console redirection. While technically not illegal or wrong, an example like this demonstrates (at least in my opinion) that the scripter hasn\u2019t fully adopted the PowerShell paradigm.\u2026","rel":"","context":"In &quot;Best Practices&quot;","block_context":{"text":"Best Practices","link":"https:\/\/jdhitsolutions.com\/blog\/category\/best-practices\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7604,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7604\/discovering-provider-specific-commands\/","url_meta":{"origin":5641,"position":2},"title":"Discovering Provider Specific Commands","author":"Jeffery Hicks","date":"July 22, 2020","format":false,"excerpt":"I've been diving into PowerShell help lately while preparing my next Pluralsight course. One of the sad things I have discovered is the loss of provider-aware help. As you may know, some commands have parameters that only exist when using a specific PSDrive.\u00a0 For example, the -File parameter for Get-ChildItem\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/07\/gsyn-2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/07\/gsyn-2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/07\/gsyn-2.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/07\/gsyn-2.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":3661,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3661\/creating-cim-scripts-without-scripting\/","url_meta":{"origin":5641,"position":3},"title":"Creating CIM Scripts without Scripting","author":"Jeffery Hicks","date":"January 29, 2014","format":false,"excerpt":"When Windows 8 and Windows Server 2012 came out, along with PowerShell 3.0, we got our hands on some terrific technology in the form of the CIM cmdlets. Actually, we got much more than people realize. One of the reasons there was a big bump in the number of shipping\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1869,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1869\/add-whatif-support-to-your-powershell-scripts\/","url_meta":{"origin":5641,"position":4},"title":"Add WhatIf Support to Your PowerShell Scripts","author":"Jeffery Hicks","date":"December 2, 2011","format":false,"excerpt":"In one of my recent articles for SMB IT, I included a PowerShell module. In the article I referenced that I included support for -Whatif in one of the functions. I was asked on Twitter to explain what I meant and how it works. So here goes. There are a\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8293,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8293\/make-defaults-a-way-of-life\/","url_meta":{"origin":5641,"position":5},"title":"Make Defaults a Way of Life","author":"Jeffery Hicks","date":"April 8, 2021","format":false,"excerpt":"A quick post today to remind you of a way to make PowerShell even easier to use. PowerShell cmdlets and functions obviously help us get a lot done, and most commands offer a number of parameters to customize what needs to be done. Unless you love typing, you probably would\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/04\/get-volume3.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/04\/get-volume3.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/04\/get-volume3.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/04\/get-volume3.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=5641"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5641\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=5641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=5641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=5641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}