Powershell stopped working, can't execute scripts or type into shell

16,552

Solution 1

Luckily had another Win10 box handy, was some Registry weirdness. HKEY_CLASSES_ROOT\Microsoft.PowershellScript.1\Shell\0\Command

Was: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-file" "%1"

Should have been: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-Command" "if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%1'"

Solution 2

I found this trick in 2014 forum post: with the Powershell open press Ctrl+X then Ctrl+C. Worked for me.

Share:
16,552

Related videos on Youtube

Geordie
Author by

Geordie

Updated on September 18, 2022

Comments

  • Geordie
    Geordie over 1 year

    my powershell in Win10 has become completely nonfunctional.

    • If I try and execute a script it hangs on an empty shell window
    • If I load Powershell (with and without Admin) it displays the copyright info but I can't type anything
    • If I load the script into ISE the play button is greyed out but the stop button is active. If I press stop the play button remains grayed out. Also can't type into the ISE console window.
    • Restarted several times, same problem

    Anyone know what this could be?

    • Jeff Zeitlin
      Jeff Zeitlin about 7 years
      What happens if you invoke powershell with -NoProfile?
  • Bill_Stewart
    Bill_Stewart about 7 years
    Wow, that's really doing things the most complicated and difficult way possible...
  • Geordie
    Geordie over 6 years
    @Bill_Stewart please inform us of the least complicated and difficult way possible
  • Bill_Stewart
    Bill_Stewart over 6 years
    Set the execution policy for the computer or in a GPO, then just run the script from the PowerShell command prompt.
  • Kamil Maciorowski
    Kamil Maciorowski over 6 years
    Can you explain why/how it works?
  • Ravindra Bawane
    Ravindra Bawane over 5 years
    Geordie, I'm glad you found something that works, but if this "solved" your problem, the first issue is that there was something else wrong with PS on your computer, and might still be.
  • Geordie
    Geordie over 5 years
    @music2myear I can't remember exactly what I was doing but the root cause was me manually tooling around with the registry in the first place, or I was following a tutorial that set an invalid key etc
  • Admin
    Admin almost 2 years
    This did work for me, and I no longer had to do this upon restarting Powershell, but I'd also like to understand why it worked. Is it possible some process was causing it to hang and the CTRL+C broke out of that process?