Overview

When a device gets imaged through SCCM, the deployment context, which task sequence ran, the OS build that was originally installed, disappear the moment the task sequence ends. There is no built-in mechanism in SCCM to persist this information for later reporting.

This guide walks you through a complete solution that tattoos task sequence metadata directly into a custom WMI class on the device, collects it via hardware inventory, and surfaces it in a polished SSRS report right inside the SCCM console.

All tools from this guide are in our Free SCD Subscription. You can download it using the Get Free product button in the top toolbar and select the free subscription.

What Gets Collected

The solution captures the following at imaging time:

FieldSource
Task Sequence Name_SMSTSPackageName
Package ID_SMSTSPackageID
Computer NameOSDComputerName
OS Build NumberWin32_OperatingSystem.BuildNumber
ManufacturerWin32_ComputerSystem.Manufacturer
ModelWin32_ComputerSystem.Model (or Win32_ComputerSystemProduct.Version for Lenovo)
Serial NumberWin32_BIOS.SerialNumber
Deployed By_SMSTSLaunchMode (e.g. PXE, Media)
Tattoo DateScript execution timestamp

Lenovo note: Lenovo stores the friendly model name (e.g. “Yoga 7 Gen 11”) in Win32_ComputerSystemProduct.Version rather than Win32_ComputerSystem.Model, which returns a cryptic MTM number. The script handles this automatically.

OSD Task Sequence information – Prerequisites

Part 1 — PowerShell Tattoo Script

Create a new Package in SCCM (not an Application) containing the script below, or embed it directly as a Run PowerShell Script task sequence step.



$WMINamespace = "root\cimv2"
$WMIClass = "Custom_OSD_TaskSequence"

$TSEnv = New-Object -COMObject Microsoft.SMS.TSEnvironment

function Get-TSVar([string]$Name) {
try {
$v = $TSEnv.Value($Name)
if ($null -ne $v -and $v -ne "") { return $v }
return ""
} catch { return "" }
}

$CS = Get-WmiObject -Class Win32_ComputerSystem
$CSP = Get-WmiObject -Class Win32_ComputerSystemProduct
$OS = Get-WmiObject -Class Win32_OperatingSystem
$SN = (Get-WmiObject -Class Win32_BIOS).SerialNumber.Trim()
$Manufacturer = $CS.Manufacturer.Trim()
$Model = if ($Manufacturer -like "*Lenovo*") {
$CSP.Version.Trim()
} else {
$CS.Model.Trim()
}

$Data = [ordered]@{
TSName = Get-TSVar "_SMSTSPackageName"
TSPackageID = Get-TSVar "_SMSTSPackageID"
TSMachineName = Get-TSVar "OSDComputerName"
OSBuildNumber = $OS.BuildNumber.Trim()
Manufacturer = $Manufacturer
Model = $Model
SerialNumber = $SN
DeployedBy = Get-TSVar "_SMSTSLaunchMode"
TSTattooDate = (Get-Date -Format "yyyy-MM-dd HH:mm:ss")
}

try {
$ExistingClass = Get-WmiObject -List -Namespace $WMINamespace | Where-Object { $_.Name -eq $WMIClass }
if ($ExistingClass) {
([wmiclass]"$($WMINamespace):$($WMIClass)").Delete() 2>$null
}

$NewClass = New-Object System.Management.ManagementClass($WMINamespace, [string]::Empty, $null)
$NewClass["__CLASS"] = $WMIClass
$NewClass.Qualifiers.Add("Static", $true)

foreach ($Key in $Data.Keys) {
$NewClass.Properties.Add($Key, [System.Management.CimType]::String, $false)
}
$NewClass.Properties["TSName"].Qualifiers.Add("Key", $true)
$NewClass.Put() | Out-Null

$Instance = $NewClass.CreateInstance()
foreach ($Key in $Data.Keys) {
$Instance[$Key] = $Data[$Key]
}
$Instance.Put() | Out-Null

Write-Host "WMI tattoo complete: $($WMINamespace):$($WMIClass)"
} catch {
Write-Warning "WMI write failed: $($_.Exception.Message)"
Exit 1
}

Task Sequence Step Configuration

  1. In your task sequence, near the very end — after all software installs but before the final reboot.
  2. Add a Run PowerShell Script step.
  3. Set PowerShell execution policy to Bypass.
  4. Paste the script inline or reference your package.
  5. Set the step to Continue on error so a tattoo failure never blocks imaging.

Part 2 — Hardware Inventory Extension (MOF)

This MOF definition tells SCCM’s hardware inventory agent to collect the custom WMI class.

#pragma namespace ("\\\\.\\root\\cimv2")

[ SMS_Report (TRUE),
SMS_Group_Name ("OSD Task Sequence Info"),
SMS_Class_ID ("CUSTOM|Custom_OSD_TaskSequence|1.0") ]
class Custom_OSD_TaskSequence : SMS_Class_Template
{
[SMS_Report(TRUE), key]
string TSName;

[SMS_Report(TRUE)]
string TSPackageID;

[SMS_Report(TRUE)]
string TSMachineName;

[SMS_Report(TRUE)]
string OSBuildNumber;

[SMS_Report(TRUE)]
string Manufacturer;

[SMS_Report(TRUE)]
string Model;

[SMS_Report(TRUE)]
string SerialNumber;

[SMS_Report(TRUE)]
string DeployedBy;

[SMS_Report(TRUE)]
string TSTattooDate;
};

Importing the MOF into SCCM

  1. Save the block above as OSD_TaskSequence_Tattoo.mof file.
  2. In the SCCM console, go to Administration → Client Settings.
  3. Open your Default Client Settings policy.
    • The default client setting is the only place where you can import a custom class, import will fail within a custom client setting
  4. Click Hardware Inventory → Set Classes → Add → Import.
  5. Browse to your .mof file and import it.
  6. Click OK and save. The MOF definition is now stored in the SCCM database — you can delete the file.
  7. You may uncheck the class from the Default client settings if you don’t want to gather this class for every device in your environment (like servers)
  8. Select the custom class within the Hardware Inventory settings of the desired Client Settings policy, deploy it to your target collection if not already targeted.

Note: After the first hardware inventory cycle following imaging, data will appear in the SCCM database and become queryable via SQL, CMPivot, and Resource Explorer.

Part 3 — Verifying the WMI Data

After a device has been imaged, you can verify the tattoo was written correctly by running this on the client:

Get-WmiObject -Namespace root\cimv2 -Class Custom_OSD_TaskSequence | Select-Object *

You should also verify it was collected by SCCM by opening Resource Explorer on the device in the console and navigating to Hardware → OSD Task Sequence Info.

OSD Task Sequence information

Part 4 — Importing the SSRS Report

OSD Task Sequence information

The report is a production-ready .rdl file built by System Center Dudes to show OSD Task Sequence information, featuring:

  • 6 doughnut charts — Task Sequence, OS Build, Manufacturer, Model, Deployed By, Year Deployed
  • Filter parameters — Computer Name, Task Sequence, Manufacturer, Model, Date range
  • Sortable data table with all collected fields

Import Using the SCD Advanced Report Manager

This tool is in our Free SCD Subscription. You can download it using the Get Free product button in the top toolbar.

  • Launch the Script
  • Select 1.Import
  • Enter the name of your Report Server
  • Select (or create) the SSRS folder where you want to import the report
  • Select the folder containing the report
  • Done! you can close the script and enjoy the report once some data has been collected.
OSD Task Sequence information

Manual Import (Alternative)

If you prefer to import manually:

  • Open a browser and navigate to your SSRS web portal URL, typically http://<YourSiteServer>/Reports
  • Browse to the folder where you want to store the report (e.g. ConfigMgr_ABC → SCD)
  • Click Upload in the top toolbar
  • Browse to OSD_TaskSequence_Tattoo.rdl and click Open
  • Once uploaded, click the 3 dots on the right of the report, select Manage
OSD Task Sequence information
  • In the left pane click Data sources
  • Select A shared data source and click Browse
  • Navigate to your ConfigMgr shared data source (typically located at /ConfigMgr_<SiteCode>/) and select it
OSD Task Sequence information
  • Click Save
  • Navigate back to the report and run it

Part 5 — Querying the Data Directly

If you need the data outside of the SSRS report, here is the SQL query against the ConfigMgr database:

SELECT
sys.Name0 AS ComputerName,
ts.TSName0 AS TaskSequenceName,
ts.TSPackageID0 AS TSPackageID,
ts.OSBuildNumber0 AS OSBuildNumber,
ts.Manufacturer0 AS Manufacturer,
ts.Model0 AS Model,
ts.SerialNumber0 AS SerialNumber,
ts.DeployedBy0 AS DeployedBy,
ts.TSTattooDate0 AS TattooDate
FROM v_R_System sys
JOIN dbo.v_GS_CUSTOM_Custom_OSD_TaskSequence0 ts ON sys.ResourceID = ts.ResourceID
ORDER BY ts.TSTattooDate0 DESC
OSD Task Sequence information

You can also query it live via CMPivot without waiting for a hardware inventory cycle:

Custom_OSD_TaskSequence
| project TSName, OSBuildNumber, Manufacturer, Model, DeployedBy, TSTattooDate

Troubleshooting – OSD Task Sequence information

WMI class not created / script exits with code 1 Check C:\Windows\Temp\SMSTSLog\smsts.log for the exact PowerShell error. The most common cause is the script running before WinPE has fully transitioned to the full OS — ensure the step is placed after the Setup Windows and ConfigMgr step.

Fields are empty in the database Confirm the hardware inventory MOF was imported and that a full hardware inventory cycle has run on the client. You can force one via Configuration Manager → Actions → Hardware Inventory Cycle.

Lenovo model shows MTM number instead of friendly name The script checks $Manufacturer -like "*Lenovo*". If your Lenovo devices report a different manufacturer string (e.g. “LENOVO” in all caps), adjust the comparison accordingly — Win32_ComputerSystem.Manufacturer is case-sensitive in PowerShell’s -like operator.

Report shows no data for a device that was imaged The tattoo only runs during OSD. Devices imaged before this solution was deployed will have no data. You can backfill by deploying the tattoo script as a standalone Configuration Item or running it via a collection script, though some TS-specific variables like _SMSTSPackageName will be unavailable outside a task sequence and will come back empty.

Comments (0)