View Single Post
Old 01-16-2007   #1 (permalink)
MadBison@gmail.com


 
 

set-psdebug -strict

Hello

I would like to use set-psdebug -strict, but there are some rather
large drawbacks.

1) If I put this command in a script or function, executing that script
or function alters the entire Powershell environment from that point
on. This is a little strange, as everything else that I do in that
script or function stays within the function unless I explicitly change
the scope. This means I have to find some way to reverse this action
after the script exits.

2) Problem is, I cannot read the start of this setting before I change
it. Therefore, I will never be able to set it back the way it was. I
will ave to make a guess that it was off, and turn it off after the
script. Now I may have turned it off, when it was on before the script.

3) There is no -NotStict opfion. I have to turn the entire PSDebug off.
I do not yet know what the repercussions of this are.

I would like this to change that setting this option within a script or
function ONLY changes it for the script.

I would also like the ability to test the current setting for the
-strict option.

And finally, I would like to be able to set it back to -notstrict
without turrning off all debugging.

Is there any way around these issues? Right now, I test the scripts and
functions with -strict on, and then remove it when all testing is done.
If I leave the -strict option on, most of the other 3rd party scripts
and functions have errors during execution.

Otherwise, Powershell ROCKS!!!

Thanks
David

My System SpecsSystem Spec