r/PowerShell • • 15h ago

Question Powershell crashes on opening and I can't figure out why.

Hi everyone, whenever I try to open powershell, it instantly closes. When I open a new terminal in VScode, I get this error:

Windows PowerShell terminated with the following error:

Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The module was expected to contain an assembly manifest.

Any help would be greatly appreciated. I have tried repairing my windows installation with sfc /scannow and DISM /Online /Cleanup-Image /RestoreHealth. I don't really know much about powershell. When I don't use VS Code it doesn't even give any error code it just flashes on the screen for half a second and closes.

If this looks familiar to another person's post upon Googling it is because I am having the exact same problem and experience to a tee, so I copied some of their sentences. https://www.reddit.com/r/PowerShell/comments/1gueufj/powershell_wont_open_and_i_cannot_figure_out_why/

10 Upvotes

5 comments sorted by

9

u/Vern_Anderson 15h ago

launch pwershell from the run box or from command line as follows. (this will rule out something in one of the three profiles

powershell.exe -NoProfile

EDIT: looking more closely at your error it seems like more of one of your modules autoloading that is more likely the cause. Does it also happen when you open the ISE?

you didn't state your OS type or version, nor whether it is PowerShell Core (greater than 6.0) or Windows PowerShell (5.x)

1

u/Objective-Round-8617 14h ago edited 12h ago

Sorry I am on Windows 10 Personal with I believe Windows PowerShell 5.x. Here is the about section copied from VS Code:

Version: 1.140.0 (user setup)

Commit: 07f806f999227108933c2e30515b26eecc1fda74

Date: 2026-09-30T10:38:38+02:00

Electron: 43.7.3

ElectronBuildId: 15386805

Chromium: 150.0.7871.250

Node.js: 24.21.0

V8: 15.0.245.31-electron.0

u/github: 1.0.89-7

u/github: 1.0.15-preview.4
OS: Windows_NT x64 10.0.19045

Forgive me I am not very knowledgeable about this. I tried launching ISE but couldn't seem to get it to launch either. I tried running your command via cmd Admin and got:

C:\Windows\system32>powershell.exe -NoProfile

Windows PowerShell terminated with the following error:

Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The module was expected to contain an assembly manifest.

I have been digging through stuff painfully obsessing and reading a ton of posts trying to fix it for hours. I might try upgrading to Windows 11 to see if that helps. I think something is corrupted inside my Windows and that may help rather than just downloading Powershell 7 as a workaround to avoid the problem.

Ai seems to think "your current error is caused by a corrupted core system library (System.Management.Automation.dll)" but I don't know if this is the correct answer/trust that fully or know if this is the way to solve it. Everything seems to end at I have to abandon Windows 10 to 11 or safely reinstall 10 in place to solve the issue. Unless someone knowledgeable here has a suggestion. I would very much appreciate further help if anyone has any suggestions.

1

u/Over_Dingo 12h ago edited 12h ago

You could try replacing it, but if it's corrupted then it may be a bigger problem
For PS5 it shows the file:

# get asasembly info:
[System.AppDomain]::CurrentDomain.GetAssemblies() | ? FullName -eq 'System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

# location:
# C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35\System.Management.Automation.dll

1

u/Objective-Round-8617 11h ago edited 2h ago

Update: was digging to the specific file and there are signs it isn't corrupted but just renamed wrong to .bak (backup) with ai suggesting I might've accidentally power cycled during a NET update and it renamed it that or something.

Am going to dig further, maybe try renaming it to not .bak as suggested to see if that fixes it. Am digging through event viewer.

Family just showed up with food though so I will get back to it after.

Edit 9 hours later: No luck. My hopeful fix didn't work still crashing. Going to go back to it in the morning. But it feels like I am doing brain surgery on my PC.

-1

u/Creative-Type9411 10h ago

open the file with notepad ++ and under the encoding tab make sure its UTF8 BOM