How to clear $Error in PowerShell?

Is there a way to clear the $Error variable that tracks errors in a PowerShell session?

If so, how do you do it?

I have tried: $error.clear

In the PowerShell ISE on Windows 7 and the $Error array is still populated.


Solution 1:

It is a .NET method call so you need parens:

$error.clear()