Here is a simple VBscript that will export Microsoft System Center Configuration Manager (SCCM / ConfigMgr) task sequence variables to a file on the root of the system drive for troubleshooting. In WinPE (Windows Pre-execution), this is typically the x:\ drive, and in the full OS phase, it’s most commonly the c:\ drive, although that cannot necessarily be assumed either.
In WinPE 4.0, you can use PowerShell instead, but I developed this for use on WinPE 3.x.
[cc]’ Author: Trevor Sullivan
‘ Date: 2012-11-16
‘ Purpose: Exports all ConfigMgr OSD task sequence variables to a text file on
‘ the root of %systemdrive%. In WinPE, this is normally x:\.
dim tsenv, var, fso, log, sh, LogPath
‘ Create a few COM objects
set tsenv = CreateObject(“Microsoft.SMS.TSEnvironment”)
set sh = CreateObject(“Wscript.Shell”)
set fso = CreateObject(“Scripting.FileSystemObject”)
‘ Get path to log file
LogPath = sh.ExpandEnvironmentStrings(“%SystemDrive%\Task Sequence Variables.txt”)
‘ Get FileStream object
set log = fso.OpenTextFile(LogPath, 8, true)
‘ Iterate over task sequence variables and write each one to log file
for each var in tsenv.GetVariables()
call log.WriteLine(var & ” = ” & tsenv(var))
call wscript.echo(var & ” = ” & tsenv(var))