First time poster so I hope this isn’t considered basic knowledge.
I’m working on a script that I fear will crash from time to time (less and less the better I get at handling errors), but I was wondering if someone here could help me out with a few things.
- In my try/catch statements, is there a way to see if an error can be handled or not?
- Is it possible to send a warning email from catch or finally? If so, anyone got any tips on where to start? I've tried to find info, but all I can find is how to handle it with robomail.
- Is there a heartbeat function somewhere? Is it hard to make a script to listen for a heartbeat (or check timestamp of a log file or whatever)? If #2 is hard to do, I might make another script to monitor
- Is there anything I should be aware of when turning my script into a windows task? I currently use "Write-Host", but I guess I should rather use output streams? Any other gotchas you guys are aware of that I might not have to experience myself?