non-terminating error

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Dave Wyatt Dave Wyatt 5 months, 3 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #37271
    Profile photo of Ian

    is there a way to log a non-terminating error without forcing the script to stop with '-ErrorAction Stop'

    Profile photo of Dave Wyatt
    Dave Wyatt

    You can use the -ErrorVariable parameter, and check for any records in that variable after the command exits:

    Do-Something -ErrorVariable myErrors
    if ($myErrors)
        # handle errors
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.