Photo by Jungwoo Hong / Unsplash

Update all PowerShell modules at once

Jul 28, 2020

If you download modules from PowerShell Gallery, you often need to update the module with Update-Module to be up-to-date.

I don’t like to update one by one, and even if I do in bulk with Get-InstalledModule | Update-Module I miss information about:

  • the current module version
  • to which version the module will be updated and the publication date of this version
  • the old module versions: you can have several versions of a same PowerShell module on your computer. But when you run Update-Module, only the newest version is updated, so you keep old versions on your computer

To fix this, I made a PowerShell script to update all the PowerShell modules at once. This script provide informations about the module version (current and the latest available on PowerShell Gallery) and update all the modules. If you have a module with two or more versions, the script delete them and reinstall only the latest.

You can find the last version of this script on my Github :

Update-AllPowerShellModules.ps1

Tags

Bastien Perez

Freelance Microsoft 365 - Active Directory - Modern Workplace