Exporting All SCCM Variables To A Log File For Debugging
[UPDATE] Please use the script in the following location - https://blogs.technet.com/b/deploymentguys/archive/2008/09/02/logging-all-the-configuration-manager-task-sequence-variables-part-ii.aspx.
Often when debugging a Windows deployment you might need to know the value that has been assigned to a particular variable. With a LiteTouch installation this is easy, you can just read the variables.dat file, or write a simple VBS/WSF script that displays a MsgBox() window showing the variable you want to see. However, with a ZeroTouch installation it is not so simple, mostly because everything is happening in the background on the computer your are deploying to, or you are perhaps not in front of it to be able to troubleshoot anything.
As a consequence, I always develop the deployment task sequence using LiteTouch first, and once working, I replicate it to the SCCM server. However, if you need to debug a ZeroTouch task sequence, this blog post could come in handy :-)
Attached is a simple script that will create a text file with the contents of every single deployment variable known at that moment in time, i.e. when the script is launched. You just add the script to the existing SCCM package you created that contains your MDT files and then call it using the following command added to a new task in the task sequence:
The script will create a log file in the following location on the SCCM client computer: %windir%\System32\CCM\Logs\CUSTOM_Variables-DATE-TIME.log. You can add the script as many times as you like and in pretty much any location in the task sequence, each time the script is run a new seperate log file will be created.
an example log file created with this script
This post was contributed by Daniel Oxley, a Consultant with Microsoft Services Spain