Its seems that getting away from Microsoft Deployment Toolkit (MDT) has been all the buzz lately. And really, for many of us, there is good reason to leave it behind. Garytown recently posted a great article about getting off of MDT, and the goods and bads of having it.
To summarize, from my perspective, the good things about MDT:
- Collection of VERY useful variables to use for step conditions.
- Nice wizards to get you imaging fast
- UDI (if you choose to use it) for a basic user interface to the imaging process.
- Fully fledged task sequences
And the not so good:
- Crazy long complex task sequence (mostly unused in building a bare metal image)
- Always downloading "Use Toolkit Package" (tediously annoying always watching it download, seemingly over and over again during the TS)
- Personal fear (shared by some) of integration/support fading/breaking for SCCM.
Ok, so that's MDT. Now looking at my TS, I realized, as many of us do, I was mainly using those very useful variables for some of my steps. And not a whole lot else. I also thought the drive formatting steps were handled a little better there too (don't quote me on this though, Gary/Mike have a solution for this now too). But, mostly the variables.
So, when I started reading Gary's blog, and saw the link to the Gather script, I got excited! But, then my excitement was crushed a little when I saw the script was PowerShell. Why? PowerShell is awesome! Its is but, I knew that I'd have to add PowerShell and .Net to my boot image to make it work. And all I could see is the boot image growing by 95 MB. Ok, not a lot in modern terms but, when my boot image is less than 300 MB, I considered a 30% increase not truly acceptable. But, I thought maybe I was being to stingy on the boot image. So, off to Twitter to see what everyone else does... So, a few days later, the votes were in....
And yes! I guess I am being too stingy with my boot image. But, you know what, that's ok. After all, there are 16% that also say keep the boot image small. So, I decided, to be stubborn and not add PowerShell. After all, as soon as you are past the "Apply OS Image" step and have rebooted, you're in a full version of Windows with all the goodness of PowerShell.
So, without PS the other option before applying the image is VBScript. And that's ok. VBScript actually isn't terrible for this scenario. WMI is easy to query in VBScript, and once I have a function for it, writing Task Sequence variables is just as easy. The script is attached below. And what variables does it set? Look here:
Architecture = X64 IsOnBattery = True Model = Surface Book 2 UUID = 0FFFFFFF-DFFF-7777-0999-5E4FACEB00C5 Vendor = Microsoft Corporation Make = Microsoft Corporation IsVM = False VMPlatform = Memory = 16308 Product = Surface Book 2 SerialNumber = 002123456789 BIOSVersion = 389.2370.769 BIOSReleaseDate = 20181002000000.000000+000 OSCurrentVersion = 10.0.17134 OSCurrentBuild = 17134 AssetTag = IsDesktop = False IsLaptop = True IsServer = False IPAddress = 192.168.99.122 DefaultGateway = 192.168.99.1 MacAddress = 62:45:BB:22:AD:33 ProcessorSpeed = 2112 IsBDE = True BitlockerEncryptionMethod = XTS_AES_128 IsUEFI = True SecureBootEnabled = True IsAHCI = False
So, I am kind of cheating. I took most of the queries from the Gather.ps1 and ZTIGather.wsf. But, like the Gather.ps1, it's a single script, single file.
The nice thing with this script, and how I wrote it, is you can test run it in Windows and it will let you know what it would set them to. So, no need to be fully fledged into a TS to see what gets set.
To do a test run, open an elevated command prompt and type the following:
cscript.exe //nologo "C:\test\gather.vbs"
And the test output will look similar to this:
Putting Gather.vbs to Use in a SCCM Native Task Sequence
Like any script, you run in a task sequence, first you have to put it into a package and distribute it. Then, add a "Run Command Line" step early in your task sequence to execute the gather script like the following step.
So there you go! Gather variables collected without MDT and without having to add PowerShell and .Net to your boot image. Be stingy and keep your boot image small!
Head over to Github to download the latest. Or download the file linked below. The one below, may not be the latest and greatest (but, I'll try to keep it up to date).
Like an old MDT task sequence. There is some value in running this gather step at least one more time, after you have applied your operating system.
Found issues with some models returning "Model 1234 " instead of just "Model 1234". Added trim function to most of the variables to remove leading and trailing spaces.