How Can I Speed Up PowerShell 7 Performance for Modules?

0
7
Asked By GamerChick45 On

I've been using PowerShell for automation and administrative tasks, and recently decided to revisit PowerShell Core. However, I'm facing significant performance issues. Starting an empty PowerShell 7 shell without any loaded modules takes around 15 seconds, though using the -noprofile parameter reduces that to about 2 seconds. Loading any module is also painfully slow—specifically, the dbatools module can take over 3 minutes to load. Adding common modules like ActiveDirectory and SQL in my profile results in a nearly 4-minute load time. This isn't an antivirus issue, as the same modules load without problems in PowerShell 5. Additionally, reading and writing from a file share performs about 10 times slower. I'm looking for recommended setups or guides to make PowerShell 7 more usable given these challenges.

4 Answers

Answered By PerformanceGeek88 On

Honestly, loading any large module can make PowerShell feel slow, especially with PS 7 being more modern than before. You might want to only load the parts of modules you need to optimize performance. I heard that can make a difference, even if it feels tedious.

TechWizard99 -

True, and PowerShell's Core version has its quirks. It can feel like every module is JITing every time it's loaded. It's frustrating when you need modules fast, especially for urgent tasks.

Answered By AdminPro83 On

Three minutes for DBATools sounds excessive! I’ve faced similar issues in air gapped setups. I suspect it's that certificate verification slowing things down. It might help to run some network traffic scans and see if there’s something in that arena causing the lag.

Answered By TechWizard99 On

I think the slow loading could be tied to your machine's internet connection or lack thereof. When I work on air gapped machines, I notice delays due to things like OCSP and Delta CRL checks for signed assemblies. You might want to check if the timeout settings have changed between PS 5 and 7. Also, have you noticed any slowdowns when iterating through files? That could be another bottleneck for you.

GamerChick45 -

Yeah, it's definitely an air gapped setup! I'm starting to think those certificate validation timeouts are part of the slowness. If only I could pinpoint it directly.

Answered By LinuxLover21 On

What do you have in your profile script? I'm using PS 7 on Linux, and it loads almost instantly. If your profile is taking ages because of heavy modules, it might be worth simplifying it.

GamerChick45 -

I’ve only got those two modules in my profile. Without any modules, it loads quickly, but as soon as I add anything, it slows way down. DBATools alone takes so long!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.