All PowerShell modules completely broken

Carlos Barranco 0 Reputation points
2023-11-24T09:00:33.21+00:00

For some weeks now, I am unable to effectively use any cmdlet on PowerShell on my main Windows 11 PC. Every single time I try to do anything, it says that "the Microsoft.PowerShell.Utility module could not be loaded".

Furthermore, when I try to manually import said module, it says that "a manifest file was expected, but could not be found".

I tried running a system integrity check ("sfc") multiple times by now. I have literally tried everything but reinstalling Windows.

Is there something else I can do to fix this, before resorting to "nuke" my current Windows installation?

Any help will be greatly appreciated.

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,930 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,309 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. MotoX80 32,736 Reputation points
    2023-11-26T18:30:08.9533333+00:00

    Is your PSModulePath environment variable correct? Did you do something that could have deleted or corrupted files?

    Here's what my Win11 (22H2), PS 5.1 laptop has. Run in a command prompt.

    cls
    set ps
    powershell.exe "get-module Microsoft.PowerShell.Utility | format-list"
    dir C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Utility\
    
    

    Results. Note the file size of the 2 utility files.

    
    C:\>set ps
    PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
    
    C:\>powershell.exe "get-module Microsoft.PowerShell.Utility | format-list"
    
    
    Name              : Microsoft.PowerShell.Utility
    Path              : C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1
    Description       :
    ModuleType        : Manifest
    Version           : 3.1.0.0
    NestedModules     : {Microsoft.PowerShell.Commands.Utility.dll, Microsoft.PowerShell.Utility}
    ExportedFunctions : {ConvertFrom-SddlString, Format-Hex, Get-FileHash, Import-PowerShellDataFile...}
    ExportedCmdlets   : {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
    ExportedVariables :
    ExportedAliases   : {CFS, fhx}
    
    
    
    
    C:\>dir C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Utility\
     Volume in drive C is OS
     Volume Serial Number is 36C0-6121
    
     Directory of C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Utility
    
    05/07/2022  12:24 AM    <DIR>          .
    04/12/2023  06:36 PM    <DIR>          ..
    05/07/2022  12:20 AM             2,459 Microsoft.PowerShell.Utility.psd1
    05/07/2022  12:20 AM            30,592 Microsoft.PowerShell.Utility.psm1
                   2 File(s)         33,051 bytes
                   2 Dir(s)  519,876,300,800 bytes free
    
    C:\>
    

  2. MotoX80 32,736 Reputation points
    2023-12-21T22:27:05.86+00:00

    I compared the files in your image to mine, and I found that I have this update installed.

    2023-11 Cumulative Update for Windows 11 Version 22H2 for x64-based Systems (KB5032190)

    From the file list, I see that it updates these files.

    C:\>type c:\Users\madne\Downloads\5032190.csv | findstr -i powershell.command
    "Microsoft.PowerShell.Commands.Management.dll","10.0.22621.2506","09-Nov-2023","11:03","586,752"
    "Microsoft.PowerShell.Commands.Utility.dll","10.0.22621.2506","09-Nov-2023","11:03","6,769,152"
    "Microsoft.Msmq.PowerShell.Commands.dll","10.0.22621.2506","09-Nov-2023","11:47","133,632"
    "Microsoft.PowerShell.Commands.Management.dll","10.0.22621.2506","09-Nov-2023","11:47","586,752"
    "Microsoft.PowerShell.Commands.Utility.dll","10.0.22621.2506","09-Nov-2023","11:47","6,769,152"
    

    I would think that installing KB5032190 would a logical next best step, unless you have some reason to not apply it. If the dll got overwritten, that should fix it.

    But with PS7.4, the 7.4.101 preview, and all the other instances that you have, I won't be surprised if something else got tweaked. I have WinDbg installed from the SDK into C:\Program Files (x86)\Windows Kits\10\Debuggers, and there's nothing Powershell related there.

    What all did you install? Does PS 7 work ok?

    0 comments No comments