Powershell: Pause SCCM Task Sequence with Message Box, Auto launch SMSTS.log

Hi All,

I put together this simple PS script that will generate a message box with a friendly message that your TS has failed. It will then auto launch your SMSTS.log file with CMTrace and add a Task Sequence variable of "TSFailed" which you can leverage as a step in your Task Sequence if you choose to do so.  I have selfish reasons for launching the log files automatically after "Ok" is pressed, i want my techs to learn some basic TS errors so they can come back to me with more information than.. "it broke"...

Hope you can find it useful :)

Tip: Place this in your Try/Catch steps in your TS where _SMSTSLastActionSucceeded (False)

Edit: Another cool method to notify you of failures is Rich Mawdsley's method here: https://richmawdsleyblog.wordpress.com/2017/02/10/guide-making-failed-osd-obvious/