• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
OpenTechTips

OpenTechTips

Short Guides for IT Professionals

MENUMENU
  • HOME
  • ALL TOPICS
    • Active Directory
    • Exchange
    • InfoSec
    • Linux
    • Networking
    • Scripting
      • PowerShell
    • SSL
    • Virtualization
    • Web
    • Tools
  • ABOUT
  • SUBSCRIBE
Home » Show Error Details – PowerShell

Show Error Details – PowerShell

December 27, 2022 - by Zsolt Agoston - last edited on December 27, 2022

1. Use the -Verbose switch

First, try to use the -Verbose switch with the cmdlet that produces the error message, that might print out a verbose version of the error.

2. In the Interactive Shell

Use the $Error environmental variable with Select * to get a detailed error message

$Error | Select-Object *

3. In the Try - Catch block

If you use the Try_Catch_Finally block for error handling, add the following line to the Catch block to get the detailed error shown

...
Catch {
    $PSItem | Select-Object *
}
...

Reader Interactions

Community Questions Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Tools

Secondary Sidebar

CONTENTS

  • 1. Use the -Verbose switch
  • 2. In the Interactive Shell
  • 3. In the Try – Catch block

  • Terms of Use
  • Disclaimer
  • Privacy Policy