Remove modules from the current session.

      Remove-Module [-ModuleInfo] PSModuleInfo[] [-Force]
         [-Confirm] [-WhatIf] [CommonParameters]

      Remove-Module [-Name] String[] [-Force]
         [-Confirm] [-WhatIf] [CommonParameters]

       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.

       Prompt for confirmation before running the cmdlet.

       Show what would happen if the cmdlet runs. The cmdlet is not run.

       -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


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 Commands:

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)

Copyright © 1999-2019
Some rights reserved