Building a Better Debug Task Sequence

Ok, I’ve been hanging out with Adam Gross a bit, and thought I’d steal some of his title magic for this one.

Quick Overview of what this does:

  1. Gathers Variables (Script to create variables similar to MDT) More info: So long MDT, Native CM* for Me
  2. Optional: Grab value of Registry Key Value(s) and place into a TS Variable.  I use this to quickly confirm a registry value instead of having to look it up in RegEdit, I just grab the info and place it into a TS Var, which then…
  3. Dump Variables (to a Log File in the SMSTSLog Folder) More Info: Task Sequence Variables
  4. Copy Logs to Server (After compressing)
    1. I have two steps, very similar script but supplied different variables
      (I need to re-write this so it is the same script but more parametrized.

      1. One that will copy to a common location we have for IPU and Includes additional files / folders for IPU
      2. One that will copy to a Debug location of just the CCM logs
  5. Pause
    1. In Windows if User is logged on
    2. In WinPE

image

This Child TS (Module) will only run if you set a Variable in the Parent TS for DebugMode

Examples:
image

In a Task Sequence you want to debug, you add a group, one with a set TS Variable step, and set the variable(s)” to:

  1. DebugMode = True: This will run the DebugMode Group in the Module
  2. DebugMode = Pause: This will run the Pause Group in the Module
  3. DebugCopyLogs = Runs the Copy Logs to Share Group

There are different variables because sometimes I want to add this TS Module to a TS and run “Silent”, only grabbing the variables and logs and dumping to the file server.  Sometimes I want it to Pause after it grabs the logs, and sometimes I just want it to Pause.  Because it’s setup this way, you can run the Same module for different debug scenarios.

image

For IPU, when I want it to grab logs (Panther, CCM, etc), it has several conditions to know it’s running one of my IPU task sequences:

image

image

Otherwise, it will copy CCM to a different location
image
image

For the Pause Steps, there is a Group which makes sures it’s not running in WinPE, checks if Explorer process is running and that the DebugMode = Pause is set
image

Pause Step:  This will close the Task Sequence Progress UI (since it’s annoying) and launch a command prompt, which you can then launch PowerShell or ISE.. or anything really
Requires Service UI (From MDT)

image

For WInPE..
image

image

So now if you run the Parent TS, you’ll get your logs & your pause to test scripts, or check logs… etc.

In action: It Paused, I launched CM Trace and opened the Variables Dump File.
image

Here I opened the SMSTS.log file to troubleshoot why it wasn’t copying the logs files over to the server… and found it was because I hadn’t updated the script to use the new file server name.
image

Ok, now that I fixed that… here is the logs:
image

Here I opened PowerShell ISE and am testing a script.  Since I’ve triggered it from the Task Sequence, all of the TS Vars are available in the script, so I can test & debug a script to make sure it’s providing the output I’d expect:
image

Hopefully you find this information Helpful, and can use this to help debug / troubleshoot your task sequences.

Download TS & Scripts as part of the 1809 WaaS TS Collection here: WaaS 1809 TS Collection

 

GARYTOWN.COM

1 thought on “Building a Better Debug Task Sequence”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.