non-terminating error

Welcome Forums General PowerShell Q&A non-terminating error

This topic contains 1 reply, has 2 voices, and was last updated by

 
Member
2 years, 10 months ago.

  • Author
    Posts
  • #37271
    Ian

    Participant
    Points: 0
    Rank: Member

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

  • #37272

    Member
    Points: 0
    Rank: Member

    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
    }
    

The topic ‘non-terminating error’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort