Powershell Hangs - also affects Visual Studio Package Manager console/NuGet

2

1

It seems that Powershell, right after I start my computer and log into Windows 10, will be alright for awhile. But something seems to be hanging it on occasion, where I will not be able to do anything with Powershell.

I'll open a new Powershell window, and it will not display the prompt at all. It'll show just the version up top. I've included a screenshot link to show you what I mean.

Powershell Window - Prompt never comes up:

enter image description here

Running Powershell -NoProfile has no effect when this starts. The only solution when this happens is to restart, and this gets to be time consuming if I have to do this all the time.

It was doing this on Windows 10 Build 1511, and I wound up installing the Anniversary Update. Now on Build 1607, it's still doing this.

Also, when this issue begins happening, Visual Studio 2015's Package Update Manager and NuGet's package manager will also hang and stop working as they seem to both use Powershell.

I have looked high and low on Google, and cannot find anyone having reported this exact issue. I have seen people post about it hanging on error or it working with -NoProfile, but that is not what's happening here. The prompt just doesn't come up when this rears its ugly head.

This also was happening shortly after a fresh install of Windows 10 on a new hard drive (SSHD, 1 TB), so wiping and reinstalling is not an option (that and I already lost a week on reinstalling my system earlier this summer and literally cannot afford any more extensive downtime).

Abandoned

Posted 2016-09-09T07:14:37.273

Reputation: 121

How much time did you actually give it to come up? Did you make sure there was no hidden prompt for confirmation and did you check your AV if you have one for any errors? The Windows Event Log might also have information on any errors that come up if it hangs? – Seth – 2016-09-09T09:55:38.353

I gave it about an hour. I noticed no events in the Event Log for the actual Powershell window. Now, before I installed the Anniversary Update, if I had tried to run Powershell in a command prompt window, and then closed the window, I'd get a popup that Powershell has stopped working and I would get an Event Log event that mentioned a NullReferenceException. (I no longer have those since the Anniversary Update was installed, regrettably). There were no AV errors reported (using AVG 2016). As far as hidden prompts, I do know no key strokes had any effect, so I don't think there were any. – Abandoned – 2016-09-11T00:29:29.533

That's plenty of time. Do you have any custom profile setup that loads when you start PowerShell? It really sounds like something is broken if you had errors while exiting PowerShell. Long load times could be caused by the AV scanning all the things but more than an hour sounds odd for that. – Seth – 2016-09-12T05:46:26.750

I don't really have any custom profile set up at all. I do notice a correspondence as to the Powershell freeze when AVG is also frozen in a scan... which seems to happen during the Rootkit scan almost exclusively from what I've noticed. Highly inconvenient as disabling that rootkit scan would leave me vulnerable to those. I am wondering if there isn't something with the rootkit scan that doesn't also hose Powershell. Going to try disabling that part of the scan (yes, I know, security hole and all), and see if the issue recurs. – Abandoned – 2016-10-01T20:09:18.320

There might be an option to exclude certain files or directories from scans. By targeting it to PS you might be able to minimize the security loss. – Seth – 2016-10-02T09:03:04.590

Well, I've had a reboot cycle since the last virus scan froze (even with a couple exceptions put in for the scans), and Powershell still froze. Rebooted, tested and immediately Powershell after reboot was already stuck. I'm fairly confident it's not AVG now (and whatever is causing this could be causing the AVG issue as well). Did a double-reboot (Restarted, then at the Windows 10 login screen, hit restart again, then logged in after that reboot), and it's working for now. (I had to do a NuGet update in Visual Studio so I had to restart). MalwareBytes shows no infections. Still stumped. – Abandoned – 2016-10-10T05:29:18.960

Answers

0

OK. I am absolutely certain I've resolved the issue. After careful consideration, I uninstalled AVG antivirus as a last resort. As it was no longer completing scans at the same time the PowerShell hang would be happening, I figured I had nothing left to lose.

I've had over a week uptime a few times since uninstallation, and the issue with PowerShell hanging upon opening a window has not recurred since then. So it would appear in my case, AVG Antivirus (Free edition) was the culprit. My earlier confidence that AVG wasn't causing it was incorrect in my case, and was more peculiar as it persisted through a later version update of the antivirus software as well. I also had to use the uninstaller program from AVG's website as the initial attempt at uninstallation failed (and the PowerShell issue was persisting before I made the first uninstall attempt).

I do not know if I had a faulty installation of AVG Free to begin with, but I do know that I have had no further issues with this particular problem. Also, it was not only PowerShell and the NuGet package manager being hung, but in the end, my iPhone also refused to sync in iTunes during the issue (though I could open the photos on the phone within Windows Explorer at the same time, and I would have to reboot to resolve the issue temporarily).

At any rate, I seem to have resolved my own issue as well as a couple others. I thank everyone for their suggestions, and I hope my own issue's resolution helps someone out there running into a like problem.

Abandoned

Posted 2016-09-09T07:14:37.273

Reputation: 121

0

I don't know if it could be related but i had the same problem ( hangs of powershell, visualstudio, chocolatey / nugets, wsl bash etc ) and i've resolved removing Ext2fs drivers.

So i think that if you have such driver, or some mounted drive partitions that can be create conflicts with windows 10, you can try to disable it, reboot and retry.

I hope it can help you

Joseph Roy

Posted 2016-09-09T07:14:37.273

Reputation: 11

I'm not sure if I have those Ext2fs drivers, I don't think I do. I don't have any mounted drive partitions other than my DVD drive and C:/. I did notice chocolatey being mentioned in my searches on this, but I don't use that right now. – Abandoned – 2016-10-01T20:05:56.657

0

I had this same issue. In addition File Explorer was insanely slow to navigate paths. I did not, however, have AVG Antivirus like the OP. After some searching around, it turns out the root cause was a corrupted hard-drive.

To check if you have a corrupted drive, open disk management (the corrupted drive may cause it to take a very, very long time to open. Be patient). The drive should show up as having a RAW partition. Taking this drive Offline this drive should hopefully fix the issue.

I hope this saves someone the significant amount of time I spent trying to diagnose this issue.

GiantCowFilms

Posted 2016-09-09T07:14:37.273

Reputation: 141