Listing the MDT Variables with Windows Powershell

I was trying to find out Where MDT got all of it’s lovely variables like %SERIALNUMBER% when I stumbled across this Great post from Andrew Barnes on Variables.DAT.

So I popped over and swiped a VARIABLES.DAT file from the WinPE environment and looked at it.   As Andrew stated, it was XML data.  I find reading XML data about as exciting as painting a bathroom wall with a toothbrush.

Yes, not all the enticed about it, am I?

But I DO love playing with Windows Powershell.  And since it can NATIVELY deal with XML files (unless my poor fuzzy human brain) I choose it!


So if you’d like an EASIER way to see what variables you have in VARIABLES.DAT to see how you could play about with them, here is an easier way.



This will dump a list of all the Variable names.  Would you like them sorted?  Sure!

$MDTVars.MediaVarList.var.Name | SORT-OBJECT

“Wait! I want to see the values too!”

(Fussy fussy fussy!)


$MDTVars.MediaVarList.var | SORT-OBJECT

Not anything truly amazing in Powershell but it’s something I found particularly handy today Smile

By the way, Thanks Andrew on that post! Made MY day easier!

”The Energized Tech”

About Sean Kearney

"Living the Dream at Microsoft!" A long time ago in a Shell far far away a little guy had a dream, to work at Microsoft. For many years that dream lay by the wayside until his career encountered PowerShell, a technology so cool and easy to use, it made him sing. (Search for Highway to PowerShell and you'll see how badly ;) ) Once encountering PowerShell his career jumped from being a field technician, to working for a Fortune 15 Healthcare corporation, to working for a Microsoft BlackBelt Partner in Ottawa and working with Ed Wilson for many years on the Scripting Blog ... to his dream, handed down from the lands of Microsoft on the day his Dad passed on. A gift from beyond. So to those of you that think dreams don't happen. Think again. PowerShell changed this little person and it will change you too.