Update Manually Installed PowerShell Modules from the PowerShell Gallery

There are PowerShell modules that ship with Windows 10 that weren’t installed from the PowerShell Gallery using PowerShellGet so they can’t be updated using the Update-Module cmdlet. This also applies for any modules that you’ve installed manually yourself.

The following PowerShell script retrieves a list of the most recent version of the modules in the all users path for PowerShell modules. It determines which ones weren’t installed using PowerShellGet based on the hidden xml file that would exist in the module directory and then it determines if a newer version exists in one of the PowerShell Galleries that’s registered on your computer:


Installing the updated version is as simple as piping the previous results to ForEach-Object and nesting Install-Module with the Force parameter inside of it:


Be sure to read the follow-up to this blog article “PowerShell function to find information about module updates“.



  1. Kayfabe

    Thank you!
    Incredibly helpful! Was trying to self-sign a cert with New-SelfSignedCertificate and it wouldn’t recognize parameters.
    Realized after a while that modules needed to be updated.

  2. Francesco Mantovani

    Thank you for saving 1h of my time

  3. Nicki

    OMG you are a life-saver. THANK YOU for posting this! 🙂

  4. Olivier

    Hi Mike
    I customized your script by adding some console information (Write-Host Current Tasks, progressBar, …). However, I do not want to update the modules for AllUsers and CurrentUser modules installed in Systempath or specific App Install Path. Could you tell me how to search for modules in 2 different paths (instead of just one with the ModuleBase property) please ?
    In the beginning of the script after the first pipe on the cmdlet Get-Module,when I’m looking for filtering with Where-Object

    Here my version of your script :

    Write-Host “Task 1 – find installed module for currentUser and All Users – not in SystemPath or specific App Install Module Path” -foregroundColor green -NoNewline
    $ModuleList = Get-Module -ListAvailable |
    #Where-Object ModuleBase -Like (“$env:ProgramFiles\WindowsPowerShell\Modules\*”, (Join-Path -Path $HOME -ChildPath “Documents\WindowsPowerShell\Modules\*”))
    Sort-Object -Property Name, Version -Descending |
    Get-Unique -PipelineVariable Module |
    Write-Host ” : Completed” -ForegroundColor Yellow

    Write-Host “Task 2 – Search modules in PowershellGallery and compare version with current installed module” -foregroundColor green -NoNewline
    $Compare = ForEach ($Module in $ModuleList)
    For ($i = 1; $i -le $ModuleList.Count;$i++)
    if (-not(Test-Path -Path “$($Module.ModuleBase)\PSGetModuleInfo.xml”)) {
    Find-Module -Name $Module.Name -OutVariable Repo -ErrorAction SilentlyContinue |
    Compare-Object -ReferenceObject $Module -Property Name, Version |
    Where-Object SideIndicator -eq ‘=>’ |
    Select-Object -Property @{label=’Name’;expression={$Module.Name}},
    Write-Progress -Activity “Collecting info” -Status “Gathering Info on $($Module.name)” -PercentComplete ($i/$ModuleList.count*100)
    Write-Host ” : Completed” -ForegroundColor Yellow
    $Compare | Format-Table -AutoSize

    Write-Host “Task 3 – update module that must be updated” -foregroundColor green
    foreach ($ModuleToUpdate in $compare)
    Update-Module -Name $ModuleToUpdate.Name -Force -ErrorAction SilentlyContinue
    Write-Host “Module $($ModuletoUpdate.Name) is updated” -ForegroundColor cyan
    Write-Host “Completed” -ForegroundColor Yellow
    Write-Host “All Modules are up to date” -ForegroundColor Magenta


  5. Brett

    received “ModuleIsNotCatalogSigned,Validate-ModuleAuthenticodeSignature,Microsoft.PowerShell.Packa
    geManagement.Cmdlets.InstallPackage” on some these type of modules.. seems you may need to add “`-SkipPublisherCheck“` to “`Install-Module“` for packages that have been signed with different certificate authorities. PSReadLine and Pester were the modules in question


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: