How do I set the computer name dynamically during deployment in MDT?

Applies to: Microsoft Deployment Toolkit (MDT) 8456 and later
Last updated: May 2025


Problem

You want MDT to automatically assign a computer name during deployment based on a pattern or attribute (e.g., serial number, asset tag, location, or model), without manual input.


Solution

MDT supports using variables in CustomSettings.ini to dynamically assign the computer name during deployment. You can also skip the input screen using SkipComputerName=YES.


Step-by-Step Guide

1. Open CustomSettings.ini

  • Location: <DeploymentShare>\Control\CustomSettings.ini

2. Define the OSDComputerName Variable

Add the following under your [Default] or conditional section:

SkipComputerName=YES
OSDComputerName=PC-%SerialNumber%

This sets the computer name based on the device’s serial number, prefixed with “PC-”.


Common Variables for Dynamic Naming

VariableDescriptionExample Output
%SerialNumber%BIOS serial numberPC-ABC1234
%AssetTag%BIOS asset tagPC-CompanyTag
%Model%Device modelLatitude-5501
%Make%Manufacturer nameDell-5501
%MacAddress%MAC addressPC-00A1B2C3D4E5

You can combine or modify these for custom naming schemes.


Example – Location-Based Naming

[Settings]
Priority=Location, Default

[NYC]
OSDComputerName=NYC-%SerialNumber%
SkipComputerName=YES

[Default]
OSDComputerName=GEN-%SerialNumber%
SkipComputerName=YES

MDT will detect the Location value (if set elsewhere) and apply the appropriate naming format.


Optional: Set via Task Sequence Variable

If needed, you can also set OSDComputerName directly in the Task Sequence:

  • Open the Task Sequence > Click Add > General > Set Task Sequence Variable
  • Name: OSDComputerName
  • Value: PC-%SerialNumber%

Place this step early in the Task Sequence (before “Install Operating System”).


Testing and Validation

  • Boot into a test deployment and let MDT assign the name.
  • Check logs at C:\MININT\SMSOSD\OSDLOGS\ZTIGather.log to see resolved variables.

Notes

  • Avoid using special characters or exceeding 15 characters (NetBIOS limit).
  • You can combine this with domain join automation for seamless naming + AD integration.
  • If variable returns blank, ensure BIOS fields are populated or fall back to default.