I’m starting a DCM project for a customer and one of the requirements is to determine whether a system was deployed via a ConfigMgr task sequence. This seemed like a simple request but initially stymied me as to how to best implement it with a significant level of authority that cannot be easily circumvented. I came up with the following options, along with input from colleagues:
From this discussion I received an interesting tidbit from Nate Bachmeier, a ConfigMgr SDET, to look for a registry key named CM_DSLID. A quick search on a Windows 7 64-bit workstation yielded the following:
HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion CM_DSLID = P01:C0100123 HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion MC_DSLID = C0100045
HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion CM_DSLID = P01:C0100123
HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion MC_DSLID = C0100045
In this example, P01 is the primary site to which the system is assigned, C0100123 is the task sequence ID (C01 is the central site) and C0100045 is the OS image package ID.
Michael Niehaus pointed out that MDT has some logic in ZTITatoo.wsf to create the second key if _SMSTSPackageID is populated.