Load Modules
Custom Module Path
Powershell automatically scans modules at certain locations. Inspect existing module path by:
ps1
$env:PSModulePath -split ';' # windows
1
ps1
$env:PSModulePath -split ':' # linux/mac
1
You can add your module location inside your profile file.
ps1
$env:PSModulePath += [IO.Path]::PathSeparator + '<path>'
1
Lazy Loading
Powershell lazily loads a module when member from it is called.
Loaded Modules
Inspect all loaded modules in current session:
ps1
Get-Module
1
Check whether certain module name is loaded:
ps1
Get-Module -Name '<name>'
1
TIP
Use gmo
alias for Get-Module
.
Import Modules
Import a module in current session.
ps1
Import-Module -Name '<name>'
1
TIP
Use ipmo
alias for Import-Module
.
Unload Modules
Unload a module from current session.
ps1
Remove-Module '<name>'
1
TIP
Use rmo
alias for Remove-Module
.