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:
cscript.exe %deployroot%\scripts\CUSTOM_SCCMVariables.vbs
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
Disclaimer: The information on this site is provided "AS IS" with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of included script samples are subject to the terms specified in the Terms of Use .
Comments
Anonymous
January 01, 2003
Hello, So i find the link to SCCM Native Variables (with or without MDT...). Go --------------------Anonymous
January 01, 2003
Hello, So i find the link to SCCM Native Variables (with or without MDT...). Go --------------------Anonymous
January 01, 2003
I wish to capture the Task Sequence Completed code from smsts.log file during my OSD and use the same as a condition to run a msgbox script that says "Deployment Successful" with condition for Task Sequence Completed code = 0x00000000 else "Deployment Failed" for Task Sequence Completed code != 0x00000000Anonymous
January 01, 2003
Thanks Daniel for this wonderful script.Anonymous
May 03, 2010
I had to modify the VBS for x64 support and would recommend that you fix the path for 64bit systems (SysWOW64 instead of system32).Anonymous
November 12, 2013
Its useful for ZTI. Thanks.