PowerShell Genie

Remove-Module

Use Remove-Module to unload an imported module from the current session — handy when testing a new version of your own module.

Command 1 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn — remove-module

Syntax

1PS> Remove-Module [-Name] <String[]> [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
2PS> Remove-Module -FullyQualifiedName <ModuleSpecification[]> [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
See the command anatomy

Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

Remove-Module [-Name] <String[]> [-Force] [-WhatIf] [-Confirm] [<CommonParameters>] Remove-Module -FullyQualifiedName <ModuleSpecification[]> [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
  1. Stage 1Remove-Module-Name -Force -WhatIf -Confirm -FullyQualifiedName -Force -WhatIf -Confirm

    Try it

    Windows PowerShell

    PowerShell example · browser support is limited.

    Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.

    Interactive simulation · fictional data

    Examples

    Remove-Module -WhatIf

    1PS> Remove-Module Microsoft.PowerShell.Management -WhatIf
    Show reference output

    Illustrative output · values vary by environment

    What if: Performing the operation "Remove Module" on target "Microsoft.PowerShell.Management".

    Import-Module -Force #

    1PS> Import-Module MyMod -Force # reload this script module after editing its functions
    Show reference output

    Illustrative output · values vary by environment

    ModuleType Version    Name
    ---------- -------    ----
    Script     3.1.0.0    Microsoft.PowerShell.Utility
    Binary     1.0.0.1    PackageManagement

    Parameters

    Parameter definitions:

    • -Name
    • -FullyQualifiedName
    • -Force
    • -WhatIf

    Microsoft Learn — remove-module

    Unload a module without uninstalling it

    Remove-Module removes an imported module and its exported commands from the current session. It leaves installed files on disk. Use Uninstall-Module for modules managed by PowerShellGet when you intend to remove an installed package.

    Check the session first

    Get-Module -Name Pester checks loaded modules; Get-Module -ListAvailable -Name Pester checks discovery on disk. Removing a module does not prevent PowerShell from importing it again when you call one of its commands.

    Reloading has limits

    Force-importing a script module can refresh functions, but an assembly loaded by a binary module may remain in the process. Start a fresh PowerShell session when you need to test a different loaded assembly.

    Check the loaded modules again after removal. A successful removal normally has no pipeline output; a missing table of results does not mean nothing happened.

    Inspect loaded and available modules · Import or reload a script module

    Updated 1 October 2026. Browser outputs are fictional; check the installed module help for your environment.

    Recap

    Remove-Module Use Remove-Module to unload an imported module from the current session — handy when testing a new version of your own module.

    Next: Get-Module
    Genie guideRemove-Module

    Use Remove-Module to unload an imported module from the current session — handy when testing a new version of your own module. The console below is pre-loaded — run it, then change a value and run it again.