0
0
PowerShellscripting~20 mins

Installing modules (Install-Module) in PowerShell - Practice Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
PowerShell Module Installer Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this PowerShell command?
You run the command Install-Module -Name Pester -Scope CurrentUser -Force on a system where Pester is already installed for the current user. What will happen?
PowerShell
Install-Module -Name Pester -Scope CurrentUser -Force
AThe Pester module is reinstalled without asking for confirmation.
BAn error occurs because the module is already installed.
CThe command prompts to confirm overwriting the existing module.
DThe module is installed globally for all users.
Attempts:
2 left
💡 Hint
Think about what the -Force parameter does in Install-Module.
💻 Command Output
intermediate
2:00remaining
What error does this command produce?
You run Install-Module -Name NonExistentModule on a system connected to the internet. What error will PowerShell show?
PowerShell
Install-Module -Name NonExistentModule
ASyntax error: Missing required parameters.
BAccess to the repository is denied due to lack of permissions.
CThe module installs successfully with default settings.
DNo match was found for the specified module 'NonExistentModule'.
Attempts:
2 left
💡 Hint
Consider what happens when a module name does not exist in the repository.
📝 Syntax
advanced
2:00remaining
Which command correctly installs a module for all users without prompts?
Choose the correct PowerShell command to install the module 'Az' for all users and suppress any confirmation prompts.
AInstall-Module -Name Az -Scope CurrentUser -Confirm:$false
BInstall-Module -Name Az -Scope AllUsers -Force
CInstall-Module -Name Az -Scope AllUsers -Confirm:$true
DInstall-Module -Name Az -Scope CurrentUser -Force
Attempts:
2 left
💡 Hint
Think about the scope parameter and how to suppress prompts.
🚀 Application
advanced
2:00remaining
How to install a module from a specific repository?
You want to install the module 'PSReadLine' from the repository named 'MyRepo'. Which command will do this correctly?
AInstall-Module -Name PSReadLine -Repo MyRepo
BInstall-Module -Name PSReadLine -Source MyRepo
CInstall-Module -Name PSReadLine -Repository MyRepo
DInstall-Module -Name PSReadLine -Scope MyRepo
Attempts:
2 left
💡 Hint
Check the parameter name for specifying the repository in Install-Module.
🔧 Debug
expert
3:00remaining
Why does this Install-Module command fail with an error?
You run the command Install-Module -Name AzureAD -Scope AllUsers but get an error saying you do not have permission to install for all users. What is the most likely cause?
PowerShell
Install-Module -Name AzureAD -Scope AllUsers
AYou need to run PowerShell as Administrator to install modules for all users.
BThe module AzureAD does not support installation for all users.
CThe -Scope parameter is invalid and should be omitted.
DThe module is already installed for the current user, so installation is blocked.
Attempts:
2 left
💡 Hint
Think about permissions required for system-wide changes.