Skip to content

Modules

neztach edited this page Aug 31, 2023 · 1 revision
Code Explanation
Get-Command -Name *module* -Module mic*core
Which commands can I use to work with modules?
Get-Module -ListAvailable
Show me all of the modules installed on my system (controlled by $env:PSModulePath)
Get-Module
Show me all of the modules imported into the current session
$PSModuleAutoLoadingPreference = 0
Disable auto-loading of installed PowerShell modules, when a command is invoked
Import-Module -Name NameIT
Explicitly import a module, from the specified filesystem path or name (must be present in $env:PSModulePath)
Remove-Module -Name NameIT
Remove a module from the scope of the current PowerShell session
New-ModuleManifest
Helper function to create a new module manifest. You can create it by hand instead.
New-Module -Name trevor -ScriptBlock {
    Function Add($a,$b) { $a + $b }
}
Create an in-memory PowerShell module (advanced users)
New-Module -Name trevor -ScriptBlock {
    Function Add($a,$b) { $a + $b }
} | Import-Module
Create an in-memory PowerShell module, and make it visible to Get-Module (advanced users)

Clone this wiki locally