Time to get again to the to weblog. I’ve been working via my backlog of initiatives. These are issues that I began writing or updating however then acquired pushed to the again of the road. Certainly one of these initiatives is a PowerShell module I wrote as a educating instrument. The concept was to create brief quizzes on PowerShell subjects that somebody might absorb a PowerShell session. My thought was to create quizzes on PowerShell subjects, however you may create a quiz on something. If you wish to strive issues out, set up the PSQuizMaster module from the PowerShell Gallery. The module will work in Home windows PowerShell and PowerShell 7, together with cross-platform.
Take a Quiz
I’ve written a number of pattern quizzes that ship with the module. Use the Get-PSQuiz
command to show them,

The module defines a variable that signifies the place you retain your quizzes. The default is the pattern quiz folder.
PS C:> $PSQuizPath
C:Program FilesWindowsPowerShellModulesPSQuizMaster1.0.0quizzes
You probably will wish to create your personal listing. You may run Set-PSQuizPath
to replace the variable.
PS C:> mkdir c:quizzes
Listing: C:
Mode LastWriteTime Size Title
---- ------------- ------ ----
d----- 8/25/2023 5:39 AM quizzes
PS C:> Set-PSQuizPath -Path c:quizzes
PS C:>
This can create a small JSON file beneath $HOME.
PS C:> dir $dwelling.psquizsettings.json
Listing: C:Usersartd
Mode LastWriteTime Size Title
---- ------------- ------ ----
-a---- 8/25/2023 5:39 AM 226 .psquizsettings.json
PS C:> dir $dwelling.psquizsettings.json | get-content
{
"PSQuizPath": "c:quizzes",
"Up to date": "8/25/2023 5:39:27 AM",
"Computername": "WIN10"
}
To any extent further, whenever you import the module, $PSQuizPath
will level to the folder you’ve specified. In order for you, you may copy the pattern quizzes to this new location.
PS C:> Copy-PSSampleQuiz -Path C:quizzes
Listing: C:quizzes
Mode LastWriteTime Size Title
---- ------------- ------ ----
-a---- 8/7/2023 2:47 PM 3206 Aliases.quiz.json
-a---- 8/6/2023 10:31 PM 6266 demo.quiz.json
-a---- 8/7/2023 2:47 PM 4032 pshelp.quiz.json
-a---- 8/7/2023 2:47 PM 4688 remoting.quiz.json
To take a quiz, run Invoke-PSQuiz
. You may tab-complete the quiz file.

Some quiz questions may need further feedback. On the finish of the quiz is your grade.

Making a Quiz
Quizzes are saved in JSON recordsdata.
{
"$schema": "https://uncooked.githubusercontent.com/jdhitsolutions/PSQuizMaster/major/psquiz.schema.json",
"metadata": {
"title": "PowerShell Aliases",
"creator": "Jeff Hicks",
"description": "A brief quiz on utilizing aliases in PowerShell.",
"model": "0.2.3",
"id": "68d30b11-971e-4104-9d76-d862bcef6a37",
"up to date": "2023-08-06 23:55:09Z"
},
"questions": [
{
"question": "What command will display currently defined PowerShell aliases?",
"answer": "Get-Alias",
"distractors": [
"Show-Alias",
"$PSAlias",
"Get-AliasDefinition",
"Find-PSAlias"
],
"word": ""
},
{
"query": "What PSDrive reveals PowerShell aliases?",
"reply": "Alias",
"distractors": [
"A:",
"$Alias",
"psalias",
"$PSAliasDrive"
],
"word": "The drive title, doesn't embrace the colon (:)."
},
{
"query": "What command do you employ to create a customized alias?",
"reply": "New-Alias",
"distractors": [
"Get-Alias",
"Add-Alias",
"New-PSDrive",
"Import-Alias"
],
"word": "You can use Import-Alias to recreate aliases exported with Export-Alias."
},
{
"query": "How are you going to defend an alias from being overwritten?",
"reply": "Set an possibility of ReadOnly or Fixed",
"distractors": [
"You can't protect it",
"Set the scope to private",
"Set the scope to global"
],
"word": ""
}
]
}
I’ve created a JSON schema so you may create a quiz file immediately in VS Code. The module has instructions for creating a brand new quiz file and questions, however the easiest way is to run New-PSQuiz
and observe the prompts.

The solutions within the quiz file are saved in plain textual content. I added an choice to masks the solutions.
Get-PSQuiz -Title *filtering* | Defend-PSQuizFile
The method I take advantage of to masks the solutions isn’t difficult and simply undone.

It’s aimed toward deterring informal “cheaters.”
I’m curious to find out how you employ this module. One thought I had is that you would create a take a look at for a person group assembly. Or you would use it for personal, inside coaching lessons.
PSQuickQuiz
The module additionally has a command known as Invoke-PSQuickQuiz. This operate will dynamically create a take a look at primarily based on PowerShell instructions. The default is to make use of all modules in your pc. However you may exclude or specify a module.
Invoke-PSQuickQuiz -ModuleName Microsoft.Powershell.*

When completed, you’ll get a grade.

I’ve a number of different concepts to boost this module, however I’d love to listen to from you. You may go to the challenge’s repository and publish a problem or begin a dialogue.
Get pleasure from and have an awesome weekend.