I use Start-Transcript and Stop-Transcript in my script. The issue is if someone does a ctrl+break in ISE with the read button , or just a ctrl+c in the window. The script ends , but Stop-Transcript never gets called. This locks the file and I need to do a manual Stop-Transcript to unlock the file.
So how can this be solved , that even on a ctrl+c , I can do this cleanup ?
In win32 I know I can register a function that gets called and I would be able to do this.