4

I'm on Windows 8.1 and have been using this particular Windows installation for about 3 years. I am not a heavy Powershell user per se, but I do some programming and any command line work (git, node) is typically done in Powershell - either the "built in" one or running the shell through ConEmu.

In the last few days, PowerShell started acting up. The window would hang on startup. So I tried removing all commands from my profile. Now at least I got to the prompt. However, if I try to enter a command such as

cd src

it will hang there, apparenty forever. The same if I do tab-completion.

Some commands work fine. The ones I have found are actual program files, such as git, node and ember. However, they don't help me a lot if I can't get to the directory I need to be in...

Set-Location has the same problem.

Windows is being kept up to date and I have no outstanding updates that are waiting.

Anything I can do to get my shell back? I'll try to answer any requests for system info but if they are to be found through PS commands I might need an alternative.

Thanks for any suggestions!

Edit: Checking the version actually worked.

Major  Minor  Build  Revision
-----  -----  -----  --------
4      0      -1     -1

Edit 2: Output of $PSVersionTable:

Name                           Value
----                           -----
PSVersion                      4.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.42000
BuildVersion                   6.3.9600.17400
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion      2.2

Edit 3: After looking further at ProcMon, here is the last thing I see from any process containing "powershell" in the name after it has listed the contents of the directory:

Screenshot of ProcMon events after powershell is frozen

10
  • What version of Powershell?
    – rrirower
    Commented Mar 21, 2016 at 13:37
  • v4, pasting in the question now. Commented Mar 21, 2016 at 13:39
  • What do you get if you try the command $PSVersionTable?
    – rrirower
    Commented Mar 21, 2016 at 13:42
  • Added above. :) Commented Mar 21, 2016 at 13:47
  • Does the same problem occur if you run in the ISE?
    – rrirower
    Commented Mar 21, 2016 at 13:51

1 Answer 1

0

I had this same issue. Running the following commands in an elevated cmd prompt fixed it for me:

sfc /scannow
dism /online /cleanup-image /restorehealth

The first is the System File Checker, which checks for and attempts to correct corrupted OS files.

The second, DISM, is used for online and offline Windows image manipulation. Using the /online switch tells it to use the live Windows environment currently running. This command will attempt to repair a corrupted Windows OS as well.

3
  • Hi jParnell, on this site we expect complete answers, where readers can see that the answer is correct, without having to look up references. You could improve your answer by explaining what teh commands do and maybe link command reference links for them. Commented Sep 22, 2023 at 12:48
  • Thank you for your suggestion. I have edited my answer to follow up.
    – jParnell
    Commented Sep 25, 2023 at 11:35
  • The commands listed are in the incorrect order - /RestoreHealth must be run prior to /ScanNow
    – JW0914
    Commented Feb 25 at 12:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .