After reinstalling Windows a few months ago, I've noticed that PowerShell is extremely slow to start and execute commands. For instance, it takes around 8 seconds to show the prompt after launching, 15 seconds to run 'ls' in a directory with 10 items, and about 6 seconds for basic directory changes like 'cd..' or 'cd directoryname'. This slowness makes it nearly unusable, forcing me to use the regular command prompt. I even tried installing PowerShell 7.5.2, but the issue persists. I found out about potential profile issues and checked the locations of my profile files but found none. Could the absence of a profile file be causing this?
1 Answer
It sounds like you might be dealing with a ngen issue. You can try following some optimization steps like those found in this guide: [Boost PowerShell Performance with ngen](https://simeononsecurity.com/guides/boost-powershell-performance-with-ngen/). Give it a shot!
Thanks so much. This was the solution! I ran both scripts mentioned. Initially, nothing changed, but after a restart, PowerShell is back to being super fast, just like before.