Why Does PowerShell Take So Long to Start?
Asked by
!keep it simple
I've been having issues with PowerShell on my Windows Terminal. Whenever I boot up my PC, it takes around 10-15 seconds to become responsive, and then my whole screen goes black for about half a minute before everything starts working. I really don't think this is a problem related to my PC's specifications since it has been running fine until recently. This lagging issue just started two days ago. Any advice on how to fix it would be greatly appreciated!
Answers
If cmd and PowerShell work fine in VS Code, the problem might be specific to the Windows Terminal. Itโs possible you have a proxy or some settings that are causing those lags. Consider setting these environment variables:
- POWERSHELL_CLI_TELEMETRY_OPTOUT = "1"
- POWERSHELL_UPDATECHECK = "Off"
Setting these could help reduce startup delays.
Reply to this answer
I had a similar issue at work where PowerShell would lag for several minutes when opening. It turned out my modules folder had about 10GB of unnecessary modules to load at startup, specifically due to multiple versions of AWS PowerShell modules piling up over time. I cleaned it up by keeping only the latest versions, which fixed the performance. If you have a lot of modules, check whatโs loading on startupโit could be the culprit!
Reply to this answer
It sounds like others might be facing similar lags. If you're not finding a solution soon, you might want to narrow it down. Use logs or process explorer to see what's causing the delay. It could help identify if it's a specific app or process.
Reply to this answer
I experienced something like this on an older laptop. It was actually Windows Defender causing issuesโit was using a ton of CPU and making everything slow. Once I disabled real-time protection for Defender, everything ran smoothly again. Just a thought, but if nothing else is causing it, maybe something like that could be worth checking, though I understand you think it might not be the issue.
!keep it simple: I'm not sure if Defender is the cause, as this issue seems isolated to the terminal app. Thanks for sharing your experience!
Reply to this answer
Have you checked whatโs in your PowerShell profile? Avoid loading too many modules at startupโonly include the ones you use most. Additionally, a strict execution policy could slow things down if PowerShell has to check certificates for signed modules. Network issues can also cause delays while it tries to verify these certificates. It's worth taking a look!
ribbon.in.motion: But why is this only a problem with the terminal and not with Command Prompt? They seem to run fine administratively. I also checked the execution policies, and everything seems correct.
Reply to this answer
Add your answer
Answers are reviewed before publication.
agar+0p8: Exactly! I have a small modules folder, only about 2.5MB, yet I still face this issue. Thanks for sharing your experience, though!