New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When "Controlled Folder Access" is enabled, PowerShell 7.4.2 is so Slow it's Unusable #21546
Comments
Given that Windows PowerShell and PowerShell (Core) do not share technical underpinnings, I suspect that your problem isn't specific to the latter.
|
Initially I though the problem was due to PowerShell environment variables too, because I had added them using the below System.Environment methods.
However, after the slowness problem I deleted them from [Windows Settings > System > About > Advanced System Settings > Environment Variables > System Variables] (because PowerShell was frozen) hoping that would be where the issue lies – but, deleting them made no difference. Also, adding them again through those Advanced System Settings made no difference either. I also tried In addition, I tried setting Windows Terminal back to default settings and uninstalled VSCode and the PowerShell Extension for VSCode, so it was just PWSH left on the machine, and that made no difference either. I leave PowerShell pretty standard. The only other thing I changed was when I first installed PWSH after clean installing Windows it was using Windows Console Host, rather than Windows Terminal and so I changed the font size, window width and background colour by right-clicking the PWSH title bar and selecting Defaults. However, I'm not sure how to put that back to standard now. |
I've determined that this issue occurs when Microsoft Defender "Controlled Folder Access" is enabled. When temporarily changing the below Controlled Folder Access Group Policy setting to "Not configured", PowerShell works as normal again.
However, both the below PowerShell applications are on the Controlled Folder Access list of allowed applications.
Therefore I'm not sure what PowerShell 7.4.2 is doing that is being blocked by Controlled Folder Access – as neither PowerShell 5.1 nor PowerShell 7 are blocked from writing to folder locations protected by Controlled Folder Access. I can only assume it's trying to do something in an unconventional way, which is causing it to be blocked by Controlled Folder Access. In addition, ordinarily when an application is blocked by Controlled Folder Access, Event ID
While Controlled Folder Access is not part of the Windows 11 Security Baseline, it is a recommended setting in the Microsoft Security Baseline blog, therefore this is something that needs to be addressed. Security Baseline Blog:
|
Can you try to run |
The problem is still present when launching PowerShell using |
Prerequisites
Steps to reproduce
PowerShell "PowerShell-7.4.1-win-x64.msi" was working OK. After it updated to "PowerShell 7.4.2" through Windows Update, it because so slow that PowerShell is now completely unusable.
When opening PowerShell, just getting it to display a prompt takes a long time – it will just show a flashing cursor for a long time. Then, if you're able to actually get to the point where it displays the prompt, it's next to impossible to use PowerShell due to the slowness. I'm not talking about just being a bit sluggish, it is quite literally unusable as it won't do anything.
In addition, it gets even slower as time goes by. If I boot Windows and immediately go to PowerShell, I may just be able to do something like Get-ChildItem. If I boot Windows and wait 5 minutes before opening PowerShell, it's so slow it's not even possible to get to the prompt, it just stays on a flashing cursor indefinitely.
This happens whether using PowerShell in Windows Terminal, VSCode with the PowerShell Extension or just using "C:\Program Files\PowerShell\7\pwsh.exe" directly. VSCode also displays a dialogue saying it's taking too long to load.
Even worse though, is it affects PowerShell 5.1 too, so I can't even use that – as it has the same slowness issue. I have no idea why PowerShell 7 is affecting PowerShell 5.1, but it does. I also tried downloading the Microsoft Store version of PowerShell 7 and it affects this as well. So, I can't use PowerShell anywhere. Windows Command Prompt is unaffected.
I tried to uninstall and reinstall PowerShell, however it wouldn't allow me to reinstall it. During the installation process, the progress bar stopped moving half way through installing it and wouldn't ever complete.
Therefore, I reinstalled Windows from scratch and installed "PowerShell-7.4.2-win-x64.msi". PowerShell was initially fine, however after 1-2 days the same thing has happened and it has become unusable again.
All other applications on the machine work fine, just anything related to PowerShell is super slow to the point of not being usable at all.
Windows 11 23H2 (22631.3447)
PowerShell-7.4.2-win-x64.msi
Expected behavior
When opening PowerShell, it should quickly show the prompt and allow running PowerShell commands.
Actual behavior
When opening PowerShell, just getting it to display a prompt takes a long time – it will just show a flashing cursor for ages. Then, if you're able to actually get to the point where it displays the prompt, it's next to impossible to use it due to the slowness.
Error details
No response
Environment data
Visuals
Screenshot showing it's not even possible to get to the prompt, it just stays on a flashing cursor indefinitely:
The text was updated successfully, but these errors were encountered: