I have a long running script that runs as a PowerShell command for many hours. Occasionally it terminates - usually OutOfMemory. When this occurs the PowerShell window returns to PS C:\XXXXX>.
I thought simply I could have an additional PS window that listens if the other terminates in an effort to keep it alive. If the other PS window returned to PS C:\XXXX it could start the script again as a back.
Is there a simple way to do this?
Thanks
for() { .\Script.ps1 }