Very often when we visit new customers, we find that they are running fully MDT integrated Task sequences. A closer look almost equally often reveals that they only use and need the Gather step.
So, as a lightweight alternative, when only using MDT for this simple task, we now recommend to instead run this PowerShell script near, or at, the top of the Task sequence. The script will create and populate what we have found being the most commonly used MDT variables. As from 2018-12-24 ("The @gwblok Christmas edition") the script can be run in debug mode, which produces an output similar to this:
PS C:\Temp> .\gather.ps1 -debug
Architecture = X64
AssetTag = 2587-8432-5072-7229-5119-1116-54
BIOSReleaseDate = 20180831000000.000000+000
BIOSVersion = Hyper-V UEFI Release v4.0
DefaultGateway = 192.168.100.1
IPAddress = 192.168.100.100
IsDesktop = True
IsLaptop = False
IsOnBattery = False
IsServer = False
IsVM = True
MacAddress = 00:15:5D:8A:94:1C
Memory = 4094,94921875
Model = Virtual Machine
OSCurrentBuild = 17134
OSCurrentVersion = 10.0.17134
ProcessorSpeed = 2394
Product = Virtual Machine
SerialNumber = 2587-8432-5072-7229-5119-1116-54
UUID = 200A47C7-5324-40BE-A30C-C3042D34D828
Vendor = Microsoft Corporation
VMPlatform = Hyper-V
When run in TSEnvironment "OSDComputerName" will be set to the same value as the built in "_SMSTSMachineName".
The script should be invoked as early as possible in the task sequence
Advantages: Less maintenance, no MDT.
Disadvantage: You need the PowerShell optional component in your boot image.
Make sure to remember:
A special thank you to Gary Blok (@gwblok) for providing feedback and bringing energy to the refinement of this script.
2019-01-09: Protected OSDComputerName from being overwritten if already set.
2019-02-03: Added Bitlocker status information. (IsBDE, BitlockerEncryptionMethod and BitlockerEncryptionType)
2020-04-13: Additional variables when executed in Full OS: OsLocale, WindowsInstallationType, WindowsProductName, TimeZone. Added desktop chassis type "35".