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


 
 

Re: set-psdebug -strict

Oh, thats cool.

How do I tell if it was on or off before I change it so I can leave it
in the same state it was before the script ran?

Cheers.
David

Bruce Payette [MSFT] wrote:
> You can turn just strict off by doing
>
> set-psdebug -strict: $false
>
> - bruce
>
> --
> Bruce Payette [MSFT]
> Windows PowerShell Technical Lead
> Microsoft Corporation
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> Visit the Windows PowerShell Team blog at:
> http://blogs.msdn.com/PowerShell
> Visit the Windows PowerShell ScriptCenter at:
> http://www.microsoft.com/technet/scr.../hubs/msh.mspx
> My Book: http://manning.com/powershell
>
> <MadBison@gmail.com> wrote in message
> news:1169001629.996524.212650@m58g2000cwm.googlegroups.com...
> > 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