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.169
Language: C# Updated: 2026-10-13

API Reference

Command

Uninstall-ManagedModule

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

Uninstalls installed PowerShell module versions through the managed module engine.

Remarks

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

Authored help example

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
        

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.

Syntax

Uninstall-ManagedModule [-AllowLoadedModuleUninstall] -InputObject <ModuleStateInstalledModuleResult[]> [-LoadedModule <ManagedModuleLoadedModule[]>] [-Plan] [-SkipDependencyCheck] [<CommonParameters>]
#
Parameter set: InputObjectParameterSet

Parameters

AllowLoadedModuleUninstall SwitchParameter optionalposition: namedpipeline: False
Allow removal of module versions that appear loaded in the current PowerShell session.
InputObject ModuleStateInstalledModuleResult[] requiredposition: 0pipeline: True (ByValue)
Installed module rows returned by Get-ManagedModule to uninstall.
LoadedModule ManagedModuleLoadedModule[] optionalposition: namedpipeline: False
Loaded module evidence used to block risky in-session uninstalls.
Plan SwitchParameter optionalposition: namedpipeline: False
Return an inspectable uninstall plan without removing files.
SkipDependencyCheck SwitchParameter optionalposition: namedpipeline: Falsealiases: SkipDependenciesCheck
Skip checking whether removed modules are still required by other installed modules.

Outputs

PowerForge.ManagedModuleUninstallResult, PowerForge.ManagedModuleUninstallPlan

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

Parameters

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

Outputs

PowerForge.ManagedModuleUninstallResult, PowerForge.ManagedModuleUninstallPlan