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 - Info: Can you clear $error?

Reply
 
Old 08-22-2006   #1 (permalink)
Brandon Shell


 
 

Info: Can you clear $error?




My System SpecsSystem Spec
Old 08-22-2006   #2 (permalink)
Jouko Kynsijärvi


 
 

Re: Can you clear $error?

$error.clear()


My System SpecsSystem Spec
Old 08-22-2006   #3 (permalink)
Brandon Shell


 
 

Re: Can you clear $error?

$error.clear... who woulda figured.

"Brandon Shell" <tshell.mask@gmail.com> wrote in message
news:uUjfCahxGHA.800@TK2MSFTNGP06.phx.gbl...
>
>



My System SpecsSystem Spec
Old 08-24-2006   #4 (permalink)
Alex K. Angelopoulos [MVP]


 
 

Re: Can you clear $error?

In fact, if you already have populated error, you can explore what to do
with it pretty easily:

$error | Get-Member
$error.PSBase | Get-Member


"Brandon Shell" <tshell.mask@gmail.com> wrote in message
news:uB4QRfhxGHA.3264@TK2MSFTNGP03.phx.gbl...
> $error.clear... who woulda figured.
>
> "Brandon Shell" <tshell.mask@gmail.com> wrote in message
> news:uUjfCahxGHA.800@TK2MSFTNGP06.phx.gbl...
>>
>>

>
>



My System SpecsSystem Spec
Old 11-13-2006   #5 (permalink)
Andrew Watt [MVP]


 
 

Re: Info: Can you clear $error?

On Tue, 22 Aug 2006 14:12:18 -0400, "Brandon Shell"
<tshell.mask@gmail.com> wrote:

>


Hi,

Yes you can.

Run this in RC2

$Count = $Error.Count

Then run this:

$Error.RemoveRange(0,$Count)

$Error.Count is now 0.

Andrew Watt MVP
My System SpecsSystem Spec
Old 11-13-2006   #6 (permalink)
Sung M Kim


 
 

Re: Info: Can you clear $error?


Andrew Watt [MVP] wrote:
> On Tue, 22 Aug 2006 14:12:18 -0400, "Brandon Shell"
> <tshell.mask@gmail.com> wrote:
>
> >

>
> Hi,
>
> Yes you can.
>
> Run this in RC2
>
> $Count = $Error.Count
>
> Then run this:
>
> $Error.RemoveRange(0,$Count)
>
> $Error.Count is now 0.
>
> Andrew Watt MVP


Are there any differences between using "$Error.RemoveRange(...)" and
"$Error.Clear()"?
I think "Clear()" seems to do the job for me though.
I would appreciate it if there are any subtle differences between those
two.

My System SpecsSystem Spec
Old 11-13-2006   #7 (permalink)
Adam Milazzo


 
 

Re: Info: Can you clear $error?

Sung M Kim wrote:
> Andrew Watt [MVP] wrote:
>> On Tue, 22 Aug 2006 14:12:18 -0400, "Brandon Shell"
>> <tshell.mask@gmail.com> wrote:
>>

> Are there any differences between using "$Error.RemoveRange(...)" and
> "$Error.Clear()"?
> I think "Clear()" seems to do the job for me though.
> I would appreciate it if there are any subtle differences between those
> two.


If you want to clear it, then using .Clear() is almost certainly the
best way to go. It should be functionally equivalent to using
RemoveRange(), but using Clear() is shorter, more intuitive, and
probably more efficient (in a too-small to notice way, though). :-)
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Unable to clear "deleted items" with error message?! Vista mail
doesnt work!!entered incoming and outgoing info as copied! ERROR! Vista mail
clear database error .NET General
error message sent again but with different info on Vista mail
Explorer crashes w/ error info Vista performance & maintenance


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