How to fix Powershell update modules failed error?

Anonymous
2025-01-29T14:56:19+00:00

greetings;

I use a thurd party ap called Topgrade to automate all the updates, I even installed PSWindowsUpdate via the nuget package manager, however when it comes to Powershell modules it failes. the output is below:

Microsoft Windows [Version 10.0.19045.5371]

(c) Microsoft Corporation. Tüm hakları saklıdır.

C:\Windows\system32>topgrade

── 16:56:27 - Self update ──────────────────────────────────────────────────────

Checking target-arch... x86_64-pc-windows-msvc

Checking current version... v16.0.2

Checking latest released version... v16.0.2

Topgrade is up-to-date

── 16:56:28 - Chocolatey ───────────────────────────────────────────────────────

Chocolatey v2.4.1

Upgrading the following packages:

all

By upgrading, you accept licenses for the packages.

autohotkey.install v1.1.37.1 is the latest version available based on your source(s). chocolatey v2.4.1 is the latest version available based on your source(s). chocolatey-compatibility.extension v1.0.0 is the latest version available based on your source(s). chocolatey-core.extension v1.4.0 is the latest version available based on your source(s). voicemeeter.portable v1.0.7.8 is the latest version available based on your source(s). Chocolatey upgraded 0/5 packages. See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

── 16:56:48 - Scoop ──────────────────────────────────────────────────────────── Updating Scoop... Updating Buckets...

Scoop was updated successfully!

Latest versions for all apps are installed! For more information try 'scoop status'

── 16:58:24 - winget ───────────────────────────────────────────────────────────

No installed package found matching input criteria.

5 package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.

── 16:59:08 - Windows Update ───────────────────────────────────────────────────

The installer will request to run as administrator, expect a prompt.

VERBOSE: DESKTOP-1ISHII6 (29.01.2025 16:59:37): Connecting to Microsoft Update server. Please wait...

VERBOSE: Found [1] Updates in pre search criteria

VERBOSE: Found [1] Updates in post search criteria

X ComputerName Result KB Size Title


1 DESKTOP-1... Accepted KB2267602 1GB Microsoft Defender Antivirus - KB2267602 (Sürüm 1.421.1592.0) - Güncel Kanal (Geniş) için Güvenlik Zekası Güncelleştirmesi

VERBOSE: Accepted [1] Updates ready to Download

2 DESKTOP-1... Downloaded KB2267602 1GB Microsoft Defender Antivirus - KB2267602 (Sürüm 1.421.1592.0) - Güncel Kanal (Geniş) için Güvenlik Zekası Güncelleştirmesi

VERBOSE: Downloaded [1] Updates ready to Install

3 DESKTOP-1... Installed KB2267602 1GB Microsoft Defender Antivirus - KB2267602 (Sürüm 1.421.1592.0) - Güncel Kanal (Geniş) için Güvenlik Zekası Güncelleştirmesi

VERBOSE: Installed [1] Updates

── 17:02:03 - Microsoft Store ──────────────────────────────────────────────────

Scanning for updates...

Success, Microsoft Store apps are being updated in the background

── 17:03:08 - pip3 ─────────────────────────────────────────────────────────────

Requirement already satisfied: pip in c:\users\robert\appdata\roaming\python\python312\site-packages (25.0)

── 17:03:43 - Powershell Modules Update ────────────────────────────────────────

Updating modules...

Update-Module : The term 'Update-Module' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a

path was included, verify that the path is correct and try again.

At line:1 char:1

  • Update-Module
  • 
        + CategoryInfo          : ObjectNotFound: (Update-Module:String) [], CommandNotFoundException 
    
        + FullyQualifiedErrorId : CommandNotFoundException 
    
    

Powershell Modules Update failed:

0: Command failed: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -Command Update-Module

1: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe failed: exit code: 1

Location:

src\steps\powershell.rs:85

Retry? (y)es/(N)o/(s)hell/(q)uit

when I choose retry, same thing happends again. when I choose No:

── 17:09:05 - Summary ──────────────────────────────────────────────────────────

Self Update: OK

Chocolatey: OK

Scoop: OK

Winget: OK

Windows update: OK

Microsoft Store: OK

pip3: OK

Powershell Modules Update: FAILED

in adition to that, I cannot use the “Install-Module” command either, here's what happends:

Install-Module : The term 'Install-Module' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:1

  • Install-Module ~~~~~~~~~~~~~~
    • CategoryInfo : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

I have Windows 10 22H2 (Build 19045.5371) installed and Powershell is the default version of Windows 10.

Steps that i've taken: sfc/scannow, check for Windows updates manually, dism/check health, dism/repair health.

Regards.

Windows Server Remote and virtual desktops PowerShell

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question. To protect privacy, user profiles for migrated questions are anonymized.

0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2025-01-29T15:26:45+00:00

    Hello,

    Based on the information you provided, the Update-Module and Install-Module commands are not recognized, possibly due to the following reasons:

    1. The default version of PowerShell for Windows 10 is 5.1, while some features may require a later version of PowerShell. We recommend that you try installing PowerShell 7.
    2. Update-Module and Install-Module are commands in the PowerShellGet module. If the PowerShellGet module isn't installed or configured correctly, it can cause these commands to become unrecognized. Open powershell and run the following command to check if the PowerShellGet module is installed:

    Get-Module -ListAvailable PowerShellGet

    If it is not installed, you can try to install it manually by running the following command:

    Install-Module PowerShellGet -Force

    1. PowerShell 5.1, which comes with Windows 10, uses SSL 3.0 and TLS 1.0 by default, and these protocols have been deprecated. You can enable TLS 1.2 in PowerShell with the following command:

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

    1. PowerShell's execution policies or environment variables may be restricting the use of some modules. You can open PowerShell and run the following command to check the current execution policy:

    Get-ExecutionPolicy

    If the execution policy restricts the running of the script, you can try setting it to a more permissive policy (note the security risks):

    Set-ExecutionPolicy RemoteSigned

    1. Topgrade may not invoke PowerShell commands correctly when performing PowerShell module updates. You can try manually running the following command in powershell to update the module:

    Update-Module -Force

    If the manual run is successful, there may be a problem with the configuration of Topgrade. You can check Topgrade's configuration file to make sure that the PowerShell-related commands are correct.

    1. If none of the above methods solve the problem, there may be some problem with the system environment, and you can try resetting the Windows Update component. Open the Command Prompt (cmd) with administrator privileges and run the following command:

    net stop wuauserv

    net stop cryptSvc

    net stop bits

    net stop msiserver

    ren C:\Windows\SoftwareDistribution SoftwareDistribution.old

    ren C:\Windows\System32\catroot2 catroot2.old

    I hope this information helps.

    Best regards,

    Jingjing Wu

    0 comments No comments
  2. Anonymous
    2025-01-31T09:16:10+00:00

    hi again;
    thank you for your detailed and valuable SOLUTION Recommendations, i've tryed them one by one but none of them worked, I suspect that this issue may be in system general so i'm planning to perform a clean installation.
    thanks for trying to help me.

    0 comments No comments