PowerShell Scripts, Tips, Expert Advices, Forums, and Resources

image rotation

Welcome to PowerShell.com, the educational and community site for Windows PowerShell People. Get a quick overview.

Latest Forum Posts

04-17-2014 - How do I trim a line in a .txt file and append the...
04-13-2014 - XML Code
04-16-2014 - How Do I [Split Replace RegEx]

Latest Scripts

04-06-2014 - Organize Pictures by Date
04-03-2014 - BlueCat/Proteus API functions
04-03-2014 - Function to build WSDL DLL

As a Powershell.com member you will have access to:

  • Daily PowerShell tips written by Microsoft MVPs and other leading Windows PowerShell experts
  • Free Windows PowerShell advice and training provided by Microsoft MVPs and other leading Windows PowerShell experts
  • Access to leading Windows PowerShell blogs
  • A free ebook, Mastering PowerShell, written by Microsoft MVP Dr. Tobias Weltner
PowerTip of the Day

Hiding Terminating Errors

Occasionally, you may have noticed that cmdlets throw errors although you specified "SilentlyContinue" as -ErrorAction.

The -ErrorAction parameter can only hide non-terminating errors (errors that originally were handled by the cmdlet). Any error that was not handled by the cmdlet is called "terminating". These errors are typically security-related and never covered by -ErrorAction.

So if you are a non-Administrator, the following call will raise an exception even though -ErrorAction asked to suppress errors:

To suppress terminating errors, you must use an error handler:

  Get-EventLog -LogName Security 

Twitter This Tip! ReTweet this Tip!

Copyright 2012 PowerShell.com. All rights reserved.