PowerGUI Script Editor – Empty Your Runspace
Here’s a useful tip for anyone who enjoys the handy debugger in the PowerGUI Script Editor during their intensive PowerShell scripting activities
The most useful feature while debugging is the “Variables” window in the editor.
It allows you to see all the variables/objects that you declared and look inside them to see what data they contain.
The only problem is if you work in a script, making a lot of changes in the process, the Variables window will keep on filling up with all the variables that are used in the scripts even though some variables are not even used anymore.
This causes a mess in the Variables window so you kind of lose track of the things that actually matter and are worth keeping an eye on. So, I went looking in the Options (menu Tools > Options) and I found an option that resets the debug/variables windows (Runspace) every time you start a new debugging session.
Simply select the “Reset PowerShell runspace each time debugging is started.” option, press OK and you will have a nice and tidy runspace (variables/debug window) from now on.