Project

PSPublishModule

Build, test, version, sign, and publish PowerShell modules with reusable PowerForge pipelines.

Stars 48
Forks 16
PowerShell Gallery downloads 17,213
Release v3.0.186
Language: C# Updated: 2026-11-04
Command

Uninstall-ManagedModule

Module
PSPublishModule
Inputs
PSPublishModule.ModuleStateInstalledModuleResult[] System.String System.String[]
Outputs
PowerForge.ManagedModuleUninstallResult PowerForge.ManagedModuleUninstallPlan

Uninstalls installed PowerShell module versions through the managed module engine.

Syntax

Uninstall-ManagedModule
[-AllowLoadedModuleUninstall]
[-InputObject] <ModuleStateInstalledModuleResult[]>
[-LoadedModule <ManagedModuleLoadedModule[]>]
[-Plan]
[-SkipDependencyCheck]
[<CommonParameters>]
#
Parameter set: InputObjectParameterSet
Uninstall-ManagedModule
[-AllowLoadedModuleUninstall]
[-InstalledLocation <String>]
[-LoadedModule <ManagedModuleLoadedModule[]>]
[-ModuleRoot <String>]
[-Name] <String[]>
[-Plan]
[-Prerelease]
[-Scope <CurrentUser|AllUsers|Custom>]
[-ShellEdition <Auto|Desktop|Core>]
[-SkipDependencyCheck]
[-Version <String>]
[<CommonParameters>]
#
Parameter set: NameParameterSet

Description

This command removes modules from the selected managed module root without invoking PowerShellGet or PSResourceGet. It follows PSResourceGet-shaped uninstall selection semantics while adding managed dependency and loaded-module safety checks. InstalledLocation always selects the exact installed directory, whether it is bound directly or received from Get-ManagedModule pipeline output. Typed Get-ManagedModule rows retain structured scanned-root provenance, so dependency checks preserve edition/profile visibility and require roots that were available during inventory to remain available. Multiple piped rows are preflighted as one batch across physical roots and selected dependents are removed before their selected dependencies.

Examples

Uninstall the latest stable installed version of a module

Uninstall-ManagedModule -Name Company.Tools

Preview every installed module version that matches a version range

Uninstall-ManagedModule -Name Company.Tools -Version '[1.0.0,2.0.0)' -Plan

Uninstall the exact installed module returned by Get-ManagedModule

Get-ManagedModule -Name Company.Tools -Version 1.2.0 | Uninstall-ManagedModule

Parameters

-AllowLoadedModuleUninstall SwitchParameter optional
Allow removal of module versions that appear loaded in the current PowerShell session.
-InputObject ModuleStateInstalledModuleResult[] requiredposition: 0pipeline: True (ByValue)sets: InputObjectParameterSet
Installed module rows returned by Get-ManagedModule to uninstall.
-LoadedModule ManagedModuleLoadedModule[] optional
Loaded module evidence used to block risky in-session uninstalls.
-Plan SwitchParameter optional
Return an inspectable uninstall plan without removing files.
-SkipDependencyCheck SwitchParameter optionalaliases: SkipDependenciesCheck
Skip checking whether removed modules are still required by other installed modules.
-InstalledLocation String optionalpipeline: True (ByPropertyName)sets: NameParameterSet
Exact installed location supplied by Get-ManagedModule pipeline rows. It takes precedence over ModuleRoot.
-ModuleRoot String optionalpipeline: True (ByPropertyName)aliases: Pathsets: NameParameterSet
Explicit module root. Use with Scope Custom.
-Name String[] requiredposition: 0pipeline: True (ByValue, ByPropertyName)aliases: ModuleNamesets: NameParameterSet
Module names or wildcard patterns to uninstall.
-Prerelease SwitchParameter optionalaliases: AllowPrereleasesets: NameParameterSet
Restrict matching to prerelease module versions.
-Scope ManagedModuleInstallScope optionalsets: NameParameterSet
Install scope used when ModuleRoot is not supplied.
Possible values: CurrentUser, AllUsers, Custom
-ShellEdition ManagedModuleShellEdition optionalsets: NameParameterSet
PowerShell path family used when resolving default CurrentUser or AllUsers module roots.
Possible values: Auto, Desktop, Core
-Version String optionalpipeline: True (ByPropertyName)aliases: RequiredVersionsets: NameParameterSet
Exact version or NuGet-style version range to uninstall. When omitted, the latest matching version is selected.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.