Challenge - 5 Problems
PowerShell Module Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of this PowerShell command?
Consider the following command to import a module and list its commands:
What will this command output?
Import-Module Microsoft.PowerShell.Utility; Get-Command -Module Microsoft.PowerShell.Utility | Select-Object -First 3 -ExpandProperty NameWhat will this command output?
PowerShell
Import-Module Microsoft.PowerShell.Utility; Get-Command -Module Microsoft.PowerShell.Utility | Select-Object -First 3 -ExpandProperty NameAttempts:
2 left
💡 Hint
Think about common commands in the Utility module.
✗ Incorrect
The Microsoft.PowerShell.Utility module includes commands like Add-History, Add-Member, and Compare-Object. The command lists the first three command names from this module.
📝 Syntax
intermediate2:00remaining
Which option correctly imports a module only if it is not already imported?
You want to import the module 'Az.Accounts' only if it is not already loaded in the current session. Which of the following PowerShell snippets does this correctly?
Attempts:
2 left
💡 Hint
Check how to test if a module is loaded before importing.
✗ Incorrect
Option B checks if the module is not loaded using Get-Module, then imports it. Option B forces import regardless. Option B is invalid syntax. Option B uses a non-existent parameter.
🔧 Debug
advanced2:00remaining
Why does this import command fail with an error?
You run this command:
and get the error:
What is the most likely reason?
Import-Module -Name NonExistentModuleand get the error:
Import-Module : The specified module 'NonExistentModule' was not loaded because no valid module file was found in any module directory.What is the most likely reason?
Attempts:
2 left
💡 Hint
Check if the module exists on your system.
✗ Incorrect
The error means PowerShell cannot find the module files in any known module directory. This usually means the module is not installed or the name is incorrect. Option A is possible but less likely than D. Option A is false; admin rights are not always required. Option A is false; -Name is valid.
🚀 Application
advanced2:00remaining
How to import a module from a specific path?
You have a PowerShell module located at 'C:\CustomModules\MyModule'. Which command correctly imports this module from that path?
Attempts:
2 left
💡 Hint
Use the parameter that specifies the module file path.
✗ Incorrect
The -Path parameter is used to import a module from a specific file path. -Name expects a module name, not a path. -ModulePath and -Source are invalid parameters.
🧠 Conceptual
expert2:00remaining
What happens when you import a module with the -Scope Global parameter?
In PowerShell, what is the effect of importing a module using the -Scope Global parameter like this?
Choose the correct explanation.
Import-Module MyModule -Scope GlobalChoose the correct explanation.
Attempts:
2 left
💡 Hint
Think about scope and session states in PowerShell.
✗ Incorrect
The -Scope Global parameter imports the module into the global session state, so commands are available in all child scopes and scripts within the session. It does not affect privileges or user scope.