What is the best way to handle errors when using background jobs? From what I am experiencing it seems to be limited in the amount of information I can get from Receive-Job. Is there anyway to get the error exception type of the error that occurred inside the job? I normally use a try/catch construct for most of my error handling, but I am not sure if that is really useful inside the scriptblock of a job. Sorry for so many questions, just really looking for some feedback and guidance on what others use and have been successful with.
Yeah, it's pretty limited. And yes, the best way would be to implement a Try/Catch – I usually put my commands into a script, and push that to the remote machine, versus using a script block. That way I can have as much structured error handling as I want.