Skip to main content

Modules

For full details and examples, run Get-Help Find-ModulesUpdates -Detailed, Get-Help Remove-OldModuleVersions -Detailed, or Get-Help Update-Modules -Detailed.

Find-ModulesUpdates

Checks installed modules for available updates using PSResourceGet (v3) or PowerShellGet (v2). Provider selection defaults to PSResourceGet and falls back to PowerShellGet when needed.

Syntax

Find-ModulesUpdates [-Scope <String>] [-Provider <String>] [-IncludePrerelease]
ParameterDescriptionRequiredDefault
IncludePrereleaseInclude prerelease versions.NoFalse
ProviderAuto, PSResourceGet, or PowerShellGet.NoAuto
ScopeFilter by install scope: User, System, All, Unknown.NoAll

Example

Find-ModulesUpdates -Scope User -Provider Auto |
Sort-Object Name |
Format-Table Name, InstalledVersion, LatestVersion, Scope

Remove-OldModuleVersions

Removes stale module folders while keeping the most recent releases.

Syntax

Remove-OldModuleVersions -Name <String> [-Keep <Int>] [-Force] [-WhatIf] [-Confirm]
ParameterDescriptionRequiredDefault
ForceForce removal where supported.NoFalse
KeepHow many latest versions to keep.No1
NameTarget module name.Yes-

Example

# Keep the latest version and preview the removal
Remove-OldModuleVersions -Name 'PSAppDeployToolkit' -Keep 1 -WhatIf

Update-Modules

Updates installed modules to the latest available version using the selected provider, with preview and optional cleanup.

Syntax

Update-Modules [-Scope <String>] [-Provider <String>] [-Name <String[]>] [-CleanupOld] [-IncludePrerelease] [-Preview]
ParameterDescriptionRequiredDefault
CleanupOldRemove older versions after updating.NoFalse
IncludePrereleaseInclude prerelease versions.NoFalse
NameOptional module name filter (wildcards allowed).No-
PreviewShow plan only; make no changes.NoFalse
ProviderAuto, PSResourceGet, or PowerShellGet.NoAuto
ScopeTarget scope: User, System, All, Unknown.NoAll

Examples

# Dry run only
Update-Modules -Scope User -Provider Auto -IncludePrerelease -Preview

# Install updates and remove older copies
Update-Modules -Scope User -CleanupOld

Questions and answers

Do I need admin rights to update modules?

Only for system scope. Update-Modules -Scope User and Find-ModulesUpdates work without elevation; system-scope updates are skipped when not admin.

How do I clean old versions after an update?

Run Update-Modules -CleanupOld or Remove-OldModuleVersions -Name '<Module>' -Keep 1 for a specific module (add -WhatIf for a preview).