r/PowerShell • u/Objective-Round-8617 • 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/
-1
u/Creative-Type9411 10h ago
open the file with notepad ++ and under the encoding tab make sure its UTF8 BOM
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 -NoProfileEDIT: 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)