Remove modules from the current session.
Syntax
Remove-Module [-ModuleInfo] PSModuleInfo[] [-Force]
[-Confirm] [-WhatIf] [CommonParameters]
Remove-Module [-Name] String[] [-Force]
[-Confirm] [-WhatIf] [CommonParameters]
Key
-Force
Remove read-only modules. By default, Remove-Module removes only read-write modules.
The ReadOnly and ReadWrite values are stored in AccessMode property of a module.
-ModuleInfo PSModuleInfo[]
Specifies the module objects to remove.
Enter a variable that contains a module object (PSModuleInfo) or a command
that gets a module object, such as a Get-Module command. You can also pipe
module objects to Remove-Module.
-Name String[]
Specifies the names of modules to remove. Wildcards are permitted.
You can also pipe name strings to Remove-Module.
-Confirm
Prompt for confirmation before running the cmdlet.
-WhatIf
Show what would happen if the cmdlet runs. The cmdlet is not run.
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
-OutBuffer -OutVariable.
If the module includes an assembly (.dll), all members that are implemented by the assembly are removed, but the assembly is not unloaded.
Remove-Module does not uninstall the module or delete it from the computer. It affects only the current PowerShell session.
Standard Aliases for Remove-Module: rmo
Examples
Remove the BitsTransfer module from the current session:
PS C:\> Remove-Module -Name BitsTransfer
Remove all modules from the current session:
PS C:\> Get-Module | Remove-Module
Remove the BitsTransfer and PSDiagnostics modules from the current session:
PS C:\> "FileTransfer", "PSDiagnostics" | Remove-Module
“If your project doesn't work, look for the part that you didn't think was important” ~ Arthur Bloch
Related PowerShell Cmdlets:
Get-Module - Get the modules imported to the session.
Import-Module - Add a module to the session.
New-Module - Create a new dynamic module (only in memory).