Uninstall-ManagedModule
Uninstalls installed PowerShell module versions through the managed module engine.
Syntax
Uninstall-ManagedModule
[-AllowLoadedModuleUninstall]
[-InputObject] <ModuleStateInstalledModuleResult[]>
[-LoadedModule <ManagedModuleLoadedModule[]>]
[-Plan]
[-SkipDependencyCheck]
[<CommonParameters>]#InputObjectParameterSetUninstall-ManagedModule
[-AllowLoadedModuleUninstall]
[-InstalledLocation <String>]
[-LoadedModule <ManagedModuleLoadedModule[]>]
[-ModuleRoot <String>]
[-Name] <String[]>
[-Plan]
[-Prerelease]
[-Scope <CurrentUser| AllUsers| Custom>]
[-ShellEdition <Auto| Desktop| Core>]
[-SkipDependencyCheck]
[-Version <String>]
[<CommonParameters>]#NameParameterSetDescription
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.ToolsPreview every installed module version that matches a version range
Uninstall-ManagedModule -Name Company.Tools -Version '[1.0.0,2.0.0)' -PlanUninstall the exact installed module returned by Get-ManagedModule
Get-ManagedModule -Name Company.Tools -Version 1.2.0 | Uninstall-ManagedModuleParameters
- -AllowLoadedModuleUninstall SwitchParameter
- Allow removal of module versions that appear loaded in the current PowerShell session.
- -InputObject ModuleStateInstalledModuleResult[]
- Installed module rows returned by Get-ManagedModule to uninstall.
- -LoadedModule ManagedModuleLoadedModule[]
- Loaded module evidence used to block risky in-session uninstalls.
- -Plan SwitchParameter
- Return an inspectable uninstall plan without removing files.
- -SkipDependencyCheck SwitchParameter
- Skip checking whether removed modules are still required by other installed modules.
- -InstalledLocation String
- Exact installed location supplied by Get-ManagedModule pipeline rows. It takes precedence over ModuleRoot.
- -ModuleRoot String
- Explicit module root. Use with Scope Custom.
- -Name String[]
- Module names or wildcard patterns to uninstall.
- -Prerelease SwitchParameter
- Restrict matching to prerelease module versions.
- -Scope ManagedModuleInstallScope
- Install scope used when ModuleRoot is not supplied.
- Possible values:
CurrentUser,AllUsers,Custom - -ShellEdition ManagedModuleShellEdition
- PowerShell path family used when resolving default CurrentUser or AllUsers module roots.
- Possible values:
Auto,Desktop,Core - -Version String
- 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.