/
/

How to Automate Endpoint Naming Conventions and Join Processes in Windows Autopilot

by Grant Funtila, Technical Writer
How to Automate Endpoint Naming Conventions and Join Processes in Windows Autopilot blog banner image

Windows Autopilot simplifies the provisioning and deployment of Windows devices. Organizations often aim to enforce standardized endpoint naming conventions and automate Hybrid or Azure AD joins during enrollment. These automated processes help ensure consistency, reduce errors, and improve identity management, inventory tracking, and policy targeting.

Ways to automate endpoint naming conventions and join processes in Autopilot

You can automate endpoint naming conventions and join processes by configuring the Autopilot profile, using PowerShell, utilizing Intune Connector, and using Group Policy. In addition, the Registry and Command Prompt let you verify policy enforcement and naming or domain join status.

📌 Prerequisites:

  • Devices registered in Autopilot via hardware hash or OEM ID
  • Azure AD Premium for Azure or Hybrid Join
  • Windows 10/11 Pro, Education, or Enterprise editions
  • Administrative rights in Intune and Azure AD
  • Access to PowerShell and Command Prompt

📌 Recommended deployment strategies:

Click to Choose a Method

💻

Best for Individual Users

💻💻💻

Best for Enterprises

Automated method 1: Configure Autopilot profile using naming convention
Automated method 2: Automate naming with PowerShell during pre-provisioning
Automated method 3: Configure hybrid Azure AD join with Intune Connector
Automated method 4: Enforce naming using Group Policy
Verification method 1: Use Registry to validate naming policy enforcement
Verification method 2: Use Command Prompt to verify naming and domain join status

Automated method 1: Configure Autopilot profile using naming convention

You can use Microsoft Autopilot deployment profiles to assign standardized device names during the out-of-box experience (OOBE).

📌 Use Case: Organizations that want to automatically enforce a consistent naming convention during enrollment using Microsoft Autopilot deployment profiles.

  1. Sign in to the Microsoft Endpoint Manager Admin Center by heading to https://intune.microsoft.com.
  2. Go to Devices > Windows > Windows enrollment > Deployment profiles.
  3. Select a new Autopilot profile, then press Next.
  4. On the OOBE page:
    • Choose Azure AD joined or Hybrid Azure AD
    • Enable Apply device name template
  5. Use a naming pattern such as:
    • CORP-%SERIAL%
    • %USERNAME%-%RAND:4%
    • NYC-%DEVICEID%
  6. Assign the profile to Autopilot-registered devices.

💡 Notes:

  • Names must be 15 characters or fewer. They can have letters, numbers, and hyphens, but they can’t all be numbers.
  • Use the %SERIAL% macro to add a hardware-specific serial number or the %RAND:x% macro to add a random string of numbers, where x equals the exact number of digits to add.

Automated method 2: Automate naming with PowerShell during pre-provisioning

Use PowerShell scripting to rename Windows devices before domain join. This method names devices during pre-provisioning or WinPE deployment workflows.

📌 Use Case: IT administrators deploying or pre-provisioning devices outside of Autopilot’s built-in naming policies, such as in WinPE, technician-initiated provisioning, or lab environments.

  1. Press Win, type PowerShell, and click Run as administrator.
  2. Copy and paste the following script into the prompt, then press Enter:

$Serial = (Get-WmiObject -Class Win32_BIOS).SerialNumber

$NewName = “CORP-” + $Serial

Rename-Computer -NewName $NewName -Force -PassThru

💡 Tip: Use this script during pre-provisioning in technician-initiated Autopilot. You can also use it as part of a WinPE deployment script. Combine it with JSON profile injection if needed.

⚠️ Warning: Before deploying the settings change on different endpoints, testing it out on a local machine is best. (For more info, refer to: Things to look out for)

Automated method 3: Configure hybrid Azure AD join with Intune Connector

You can use the Intune Connector for Active Directory (AD) to automatically domain-join Windows Autopilot devices to an AD and register them in Azure AD as hybrid joined.

📌 Use Case: Organizations with hybrid environments that need Windows devices to automatically join both on-premises AD and Azure AD during Autopilot provisioning.

  1. Sign in to the Microsoft Endpoint Manager Admin Center.
  2. Go to Devices > Manage devices > Configuration > Create > New policy.
  3. Configure the following settings:
    • Platform: Windows 10 and later.
    • Profile type: Templates > Domain Join.
  4. Press Create, give the policy a name and description, then click Next.
  5. Configure the following:
    • Domain Name: contoso.local
    • Organizational unit (OU): OU=Computers, DC=contoso, DC=local
    • Computer Name Prefix: Use a naming variable such as IT-%SERIAL%.
  6. Press Next, assign a tag to filter the profile to specific IT groups (optional), then click Next.
  7. Select the device groups that will receive the profile in Assignments, then press Next.
  8. Define how this profile applies within assigned groups, then click Next.
  9. Review the settings, then select Create to assign the profile.

Automated method 4: Enforce naming using Group Policy

With Group Policy, you can standardize computer names across devices in traditional imaging or manual deployment scenarios without Autopilot.

📌 Use Case: IT administrators who need consistent device naming using only Group Policy

  1. Press Win + R, type gpedit, then press Enter.
  2. Navigate Computer Configuration > Administrative Templates > System > NetBIOS Name.
    • Set Computer Name Policy to a defined prefix or pattern
    • Combine with login or deployment scripts that read environment variables and rename systems before joining
    • Pair with sysprep /generalize to reset the name in imaging workflows

Verification method 1: Use Registry to validate naming policy enforcement

This method uses Windows Registry keys to access or verify device naming and Autopilot deployment information during or after provisioning.

📌 Use Case: IT administrators who need to validate device names and detect the applied Autopilot profile

  1. Press Win + R, type regedit, then press Enter.
  2. Navigate the following paths and look for the corresponding registry keys or values to determine the current machine name and Autopilot device info:

Machine name

  • Path:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName

  • Key/value:

ComputerName (REG_SZ) = “ExpectedDeviceName”

Autopilot device info

  • Path:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\Diagnostics\AutoPilot

  • Keys/values:
    • DeviceSerialNumber 
    • DeploymentProfileName

💡 Tip: You can jump directly to the ComputerName and AutoPilot folders by copying and pasting their respective paths into the address bar.

⚠️ Warning: Editing the registry can have unintended consequences. Proceed with caution and back up the registry before making changes. (For more info, refer to: Things to look out for)

Verification method 2: Use Command Prompt to verify naming and domain join status

You can use the Command Prompt to check the device’s identification, domain join status, and Autopilot logs.

📌 Use Case: IT administrators who want to troubleshoot Autopilot deployment problems or automate device renaming and join validation

  1. Press Win, type cmd, then click Run as administrator.
  2. Copy and paste the following scripts into the prompt, then press Enter:
    • To get the current device name: hostname
    • To check domain status: systeminfo | findstr /B /C:”Domain”
    • To force rejoin or rename:

netdom renamecomputer %COMPUTERNAME% /newname:NYC-%RANDOM% /force /reboot

    • To check Autopilot logs:

notepad C:\Windows\Provisioning\AutopilotDiagnostics\AutopilotDiagnostics.json

⚠️ Warning: Ensure you copy and paste the proper script, as incorrect syntax can cause errors. (For more info, refer to: Things to look out for)

⚠️ Things to look out for

RisksPotential ConsequencesReversals
Editing the Registry without backupIncorrectly editing the registry could result in corruption, so it’s best to make a backup beforehand.Export the registry key before changes by pressing File > Export.
Not testing on a local machineDeploying an untested script may cause devices to crash due to issues such as registry key incompatibility.Apply the changes you want on a local machine, and then verify if the configuration reflects the intended results.
Incorrect command syntaxIncorrect command syntax could result in registry corruption, system misbehavior, or the code not doing anything.Ensure you copy and paste the proper script into the prompt. You may also use apps like PSScriptAnalyzer to check code quality.

Troubleshooting common issues

Below are common issues you may encounter when using Autopilot to automate endpoint naming conventions and join processes, as well as how to resolve them.

Name not applied

If the device doesn’t receive the correct Autopilot profile during provisioning, it could be due to improper registration in Autopilot or incorrect group assignment in Intune Dynamic Groups.

In this case, you should ensure the device is listed in Intune’s Autopilot device. You can also review the Event Viewer logs for Autopilot events.

Hybrid join failure

Some devices may fail to complete Hybrid Azure AD Join because the Intune Connector for AD is not installed or improperly configured.

If this happens, verify that Intune Connector for Active Directory is:

  • Installed on a supported server OS
  • Running the Intune ODJ Connector Service
  • Marked as Active and Connected in the Intune portal

OU not found

Join processes may sometimes fail because the specified OU in the domain join profile is incorrect. This issue could occur if the OU doesn’t exist or has been renamed.

To resolve this issue, double-check the OU DN String in the Domain Join configuration.

NinjaOne services to enhance endpoint naming

NinjaOne simplifies and enforces naming policies in Autopilot and traditional deployment methods. It does so through:

  • PowerShell deployment: Automatically runs renaming or domain join scripts during device provisioning.
  • Compliance monitoring: Alerts admins if a device doesn’t match naming conventions after deployment.
  • Registry auditing: Detects mismatches in expected naming registry entries.
  • Remote troubleshooting: Can check join status, hostname, and deployment logs using remote CMD or file access.
  • Multi-tenant reporting: Identify misnamed or improperly joined devices across all environments.

Quick-Start Guide

NinjaOne offers several ways to automate endpoint naming and device management:

1. Agent TokenizationNinjaOne provides an Agent Tokenization feature that allows you to automatically assign critical information about target endpoints during agent deployment. This includes:

– Server information– Organization details– Location– Role

2. Flexible Naming VariablesNinjaOne supports multiple variables for device naming and configuration, including:

– ${device.location.name} – Location name– ${device.organization.name} – Organization name– ${device.serialNumber} – Device serial number– ${device.owner.email} – Assigned user email– ${device.owner.firstName} – User’s first name– ${device.owner.lastName} – User’s last name

3. Automated Device EnrollmentFor Apple devices, NinjaOne supports Automated Device Enrollment (ADE) through Apple Business Manager, which can:

– Automatically sync devices– Configure device settings– Apply naming conventions during enrollment

4. Policies and AutomationYou can create policies and automations to:

– Standardize device naming– Apply consistent configurations– Automatically join devices to specific organizations or locations

Reduce manual provisioning steps by automating naming with Autopilot

IT teams using Autopilot to enforce standardized naming conventions and the join process can help manage devices at scale with better clarity, control, and automation. In addition to Autopilot, IT admins can use Command Prompt and Registry tools to validate naming policy enforcement and join status.

Related topics:

You might also like

Ready to simplify the hardest parts of IT?