We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--dry-run
--yes
Cleanup old module versions when upgrading powershell modules and --cleanup is specified, example powershell function to do this:
function Remove-OldModule { [CmdletBinding(SupportsShouldProcess)] param () $Latest = Get-InstalledModule foreach ($module in $Latest) { $oldVersions = Get-InstalledModule -Name $module.Name -AllVersions | Where-Object { $_.Version -ne $module.Version } foreach ($oldVersion in $oldVersions) { if ($PSCmdlet.ShouldProcess("Module: $($module.Name) Version: $($oldVersion.Version)", "Uninstall")) { Uninstall-Module -Name $module.Name -RequiredVersion $oldVersion.Version -Verbose } } } }
https://luke.geek.nz/2021/06/18/remove-old-powershell-modules-versions-using-powershell/
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I want to suggest a new step
--dry-run
option? i.e., print what should be done and exit--yes
option to skip this step?
I want to suggest some general feature
Cleanup old module versions when upgrading powershell modules and --cleanup is specified, example powershell function to do this:
More information
https://luke.geek.nz/2021/06/18/remove-old-powershell-modules-versions-using-powershell/
The text was updated successfully, but these errors were encountered: