I have a `while($true)` loop with a `start-sleep -s 60` at the end of it. The purpose is to start an external PowerShell script **as a different user** which will run through a list of servers, check the event log for changes within the last minute and react accordingly. 

Since my while loop (below) is using the `-credential` flag to run the script as someone else, I'm concerned about errors (e.g. account locked out, expired password, missing file, etc). 

I tried an `if ($error)` statement, and changed the filename of the external script, but I was never alerted. I'm thinking it's because it never stops to re-check itself? 

```
while($true) { 

    # Start the scan
    Start-Process powershell -Credential $credentials -ArgumentList '-noprofile -command & c:\batch\02-Scan.ps1'

    # Sleep 60 seconds
    start-sleep -s 60

}

```

I suppose I could change my scheduled task to run every minute, but so far this loop seems to have been working great. Just want to introduce error checking while the loop is active.