Help! My VSCode is Overloaded After Too Much Scripting

0
4
Asked By ScriptMaster3000 On

Hey everyone! So I've been diving deep into PowerShell over the past year, and thanks to some ADHD meds, I've really been getting into creating scripts. I organize my functions into ps1 scripts and keep integrating them into new projects. Today, I wrote a script that used MS Graph to check which users have Entra apps lacking auto provisioning. Everything was going smoothly until I noticed the Microsoft.Graph module got disconnected.

I tried to re-import the module, but it just wouldn't and threw up errors about too many functions loaded. Closing VSCode and deleting non-system functions took ages and mostly failed, so I ended up killing my PSSession. Now, every time I try to start a new session, it just won't load. I even rebooted my VM and cleared environment variables, but nothing worked.

I'm considering reinstalling VSCode, but I'm really hoping to avoid that. Any advice? Please don't make me go back to ISE!

2 Answers

Answered By SimplifyThis On

Yeah, you definitely want to only import the modules you need. When I try to import everything from Microsoft.Graph, my console nearly crashes because it loads thousands of functions. Instead, I only import specific components like 'Import-Module Microsoft.Graph.Users.Actions' which keeps things running smoothly. Give it a try!

Answered By TechieGuru99 On

It sounds like you might have too many modules auto-importing in your PowerShell profile. Consider switching to PowerShell Core since it can handle way more functions at once. Also, instead of creating a ton of scripts, it might be a good idea to modularize your code into functions. Don't forget to use Git for version control!

ScriptMaster3000 -

I don’t have any modules in my profile, but I’ll check out PowerShell Core! Thanks for the tip about modularizing, that could help a lot.

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.