Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - set-psdebug -strict

Reply
 
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
Old 01-17-2007   #2 (permalink)
Bruce Payette [MSFT]


 
 

Re: set-psdebug -strict

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
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
Reply

Thread Tools


Similar Threads
Thread Forum
HTML 4.01 Strict Rendering .NET General
Strict search on Tags Vista file management
Strict Threading Vista mail
Set-PSDebug -Step behavior PowerShell
set-psdebug -trace 0 PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46