0
0
PowerShellscripting~5 mins

Importing modules in PowerShell - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of importing modules in PowerShell?
Importing modules in PowerShell allows you to add extra commands and functions that are not built into the default shell. It helps you reuse code and access new features easily.
Click to reveal answer
beginner
Which PowerShell command is used to import a module?
The command Import-Module is used to load a module into the current PowerShell session.
Click to reveal answer
beginner
How do you check which modules are currently imported in your PowerShell session?
Use the command Get-Module without parameters to see all modules currently loaded in your session.
Click to reveal answer
beginner
What happens if you try to import a module that is not installed on your system?
PowerShell will show an error saying it cannot find the module. You need to install the module first before importing it.
Click to reveal answer
intermediate
How can you import a module only if it is not already imported?
You can use Import-Module -Name ModuleName -ErrorAction SilentlyContinue or check with Get-Module before importing to avoid errors or duplicate imports.
Click to reveal answer
Which command imports a module named 'Az' in PowerShell?
ALoad-Module Az
BGet-Module Az
CImport-Module Az
DAdd-Module Az
What does the command Get-Module show when run without parameters?
AAll modules installed on the system
BAll modules currently imported in the session
CAll commands available in PowerShell
DAll scripts in the current folder
If a module is not installed, what will happen when you try to import it?
APowerShell will show an error
BPowerShell will import a default module instead
CPowerShell will ignore the command
DPowerShell will install it automatically
How can you avoid errors when importing a module that might already be loaded?
AUse <code>Import-Module -Force</code>
BUse <code>Import-Module -ErrorAction SilentlyContinue</code>
CUse <code>Get-Module</code> to check before importing
DBoth C and D
What is a module in PowerShell?
AA collection of commands and functions
BA script that runs automatically
CA type of variable
DA PowerShell window
Explain how to import a module in PowerShell and how to check if it is already imported.
Think about commands to load and list modules.
You got /4 concepts.
    Describe what happens if you try to import a module that is not installed and how to handle this situation.
    Consider what PowerShell does when it can't find a module.
    You got /3 concepts.