O'Reilly logo

Windows PowerShell™ 3.0 Step by Step by Ed Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 19. Handling Errors

After completing this chapter, you will be able to:

  • Handle missing parameters in scripts.

  • Limit the choices available to users of your scripts.

  • Handle missing rights and permissions in scripts.

  • Handle missing WMI providers in scripts.

  • Use Try...Catch...Finally to catch single and multiple errors in scripts.

When it comes to handling run-time errors in your script, you need to have an understanding of the intended use of the script. For example, just because a script runs once does not mean it will run a second time. Disks fail, networks fail, computers fail, and things are constantly in flux. The way that a script will be used is sometimes called the use-case scenario, and it describes how the user will interact ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required