MicroNuggets: PowerShell Error Handling Explained

Veröffentlicht am: 16 Oktober 2012
auf dem Kanal: CBT Nuggets
9,029
127

Start learning cybersecurity with CBT Nuggets. https://courses.cbt.gg/security

In this video, Don Jones covers error handling in PowerShell. Something that sets a good script apart from a truly great one is its ability to respond to errors that you anticipated ahead of time. Watch as Don demonstrates the fine art of error handling.

Everyone knows that the single most aggravating thing that can go wrong while coding is an innocuous semicolon wreaking havoc on your otherwise pristine code. But coming in at a very close second is an unanticipated error in execution that causes PowerShell to explode.

Preventing and handling errors takes foresight and planning, see some of the more common approaches to anticipating potential errors and catching them.

The trick is diagnosing your code once it's complete — find the lines of code that are actually doing something and consider whether they could return an error. This could be something like a computer not being available when we query it, or not having permission to query it.

Wrapping commands like that in Try/Catch block can provide outlets for errors, and you can also catch the error in an error variable. Don introduces you to these and many more diagnostic approaches and error handling solutions you'll need.

📁 Download the Ultimate Sysadmin Cert Guide: https://blog.cbt.gg/dyvk

⬇️ 4-Week Study Plan: MD-100 & MD-101: https://blog.cbt.gg/9dlw


Start learning with CBT Nuggets:

• PowerShell | https://courses.cbt.gg/be3


Auf dieser Seite können Sie das Online-Video MicroNuggets: PowerShell Error Handling Explained mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer CBT Nuggets 16 Oktober 2012 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 9,029 Mal angesehen und es wurde von 127 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!