Don't write-host in the Powershell.Exited event
...if you ever use the PowerShell ISE.
There's an undocumented bug in ISE whereby the tab hosting PowerShell shuts down before PowerShell itself has finished exiting. Consequently, if you include any write-host statements or other cmdlets that output to the host in your Register-EngineEvent PowerShell.Exited scriptblocks, they'll fail to execute, and they'll even stop other registered scriptblocks for this event from executing, also.
Written by Alistair Young
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Powershell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#