Task Sequence Tip: CMTrace Logging Run PowerShell Script
Receive notification right in your inbox whenever new content like this is released & sign up for our email list!
We’ll send you the latest updates, how-to’s, and solutions to empower you at every endpoint.
Recently I was asked if there was better logging for a task sequence. The person doing the asking said the SMSTS.log is useless because it doesn’t tell us what went wrong. I replied, “NONSENSE!” The SMSTS.log says everything, and I mean…everything. That’s where the confusion came in. It said too much for the average technician to understand, so it wasn’t helpful for troubleshooting. In this Task Sequence tip, I’m going to cover how you can leverage the CMTraceLog Function I’ve mentioned in other posts. This time, I’m using it in a CMTrace logging Run PowerShell script. For more details about the Run PowerShell Script, check out the Task Sequence docs I wrote.
Part of the problem is the certificate noise you see in the SMSTS.log. Those of you with HTTPS-only environments know what I’m talking about. The log is just cluttered with extra information that I wish I could suppress…
CMTrace Logging Run PowerShell Script
Basically, the person asking for better logging, only wanted a log with general information, marking milestones along the way. This way it would be easy to follow the status of a machine, or easier to troubleshoot.
To simplify logging, I made a task sequence script where you pass parameters, and it logs to a file.
Using this method, technicians can easily monitor progress via the log file and get an overview of the entire task sequence very quickly. As a bonus, the team using the task sequence could easily add information to the log along the way.
The Task Sequence
The idea here is, that anytime you want to update the log, you add a step with the logging options. You can then easily create custom logging with exactly what you want in the log, and you can leverage task sequence variables in your parameters.
Here is what the log looked like in the example task sequence above.
Isn’t this much easier for someone to monitor the progress than watching the SMSTS.log? And, by leveraging the parameters available, it helps to organize your logging into different groups during the task sequence.
Lots of Steps
There’s only one downside as I see it. This CMTrace logging Run PowerShell script adds a lot of steps to the task sequence. That means more policies and more status messages. You’ll have to decide if the pros outweigh the cons.
- The script to use is in the task sequence script posted on GitHub.
- If you are looking for another example, check out: garytown/OSD/CustomTSLogging at master · gwblok/garytown (github.com).
- Also, you might want to look at my collection of task sequence tips found here: https://www.recastsoftware.com/resources-collection/task-sequence-tips/.