How to set computer name during Windows 10 Autopilot Deployment (User-Driven Azure AD joined Scenario)

In this post I will try to demonstrate ways to set computer name for an Autopilot device during user-driven and Azure AD Joined Windows 10 Autopilot deployment. Before you continue with post, I would request you please have a look my previous blog post on Azure AD joined user-driven Autopilot deployment Step by step guide – Provision Windows 10 devices with Autopilot. 

No matter which computer naming method is applied or computer name is set during Autopilot or other deployment method, a Windows computer name can’t exceed 15 characters and all other naming convention and recommendations described in this article have to be respected to avoid any issues.

https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/naming-conventions-for-computer-domain-site-ou

If you are coming from Windows 10 deployment via Microsoft Deployment Toolkit or SCCM, you would notice that naming convention allowed for Windows Autopilot is not that flexible and you don’t have much control over it as well, at least as of now. I am pretty sure Microsoft will be providing more flexible naming mechanism that gives administrators more control over naming an Autopilot device.

Contents of this article

  • Ways to set computer name during Windows 10 Autopilot Deployment
    • Windows Autopilot Deployment Profile
    • Windows Autopilot device property
    • Few more ways
      • Custom Configuration Profile
      • Intune Win32 App
      • PowerShell Script

Windows Autopilot Deployment Profile

Enable Apply device name template setting in Autopilot deployment profile. Based on the naming convention defined here, a unique device name will be created during Autopilot deployment process. Device name template must meet following criteria:

Names must be 15 characters or less, and can contain letters (a-z, A-Z), numbers (0-9), and hyphens. Names must not contain only numbers. Names cannot include a blank space. Use the %SERIAL% macro to add a hardware-specific serial number. Alternatively, use the %RAND:x% macro to add a random string of numbers, where x equals the number of digits to add.

Windows Autopilot device property

Device name can also be set by editing existing Autopilot device properties. Here you can enter the exact device name, this name will be set as computer name during Autopilot deployment process. Unlike device name template of Autopilot deployment profile, where you provide naming convention and let Intune set a unique device name.

This option works only with Azure AD joined Autopilot deployments.

After entering the device name and saving this, if you select Autopilot device again you would find device name field is empty again, not to worry the value has been set in Autopilot service and all you need to do is initiate a Sync. After successful Sync, Device name entered earlier will reflect in Autopilot device properties.

If both the options are configured, Its important to mention here that Device Name entered in Autopilot device property takes precedence over Apply device name template in Autopilot deployment profile.

Few more ways

Custom Configuration Profile

Create a custom configuration profile for Windows 10 and later using Configuration Service Provider (CSP) OMA-URI and deploy to an Azure AD group. A reboot is required for the changes to take effect. 

This method has same restrictions as Apply device name template setting in Autopilot deployment profile. Available micros are %RAND:<# of digits> and %SERIAL% within the limit of 15 characters.

Please refer these articles for more details:

https://docs.microsoft.com/en-us/windows/client-management/mdm/accounts-csp

https://docs.microsoft.com/en-us/mem/intune/configuration/custom-settings-windows-10

Concerns with this method is that this configuration profile keeps on renaming the device, you will need to have a proper measure to remove the device targeted group so that device is not renamed again and again.

Intune Win32 App

You can write an intelligent script to rename device as per your organization’s naming convention and deploy as Intune Win32 App to an Azure AD group. Advantage of using this method that it mitigates all the device naming constraints we have with Apply device name template in Autopilot deployment profile and Custom Configuration Profile using Configuration Service Provider (CSP) OMA-URI. 

With Win32 App you can make use of detection rule to ensure that this app is not re-deployed and in turn renames devices inadvertently. A reboot is required for the changes to take effect. Please refer to my previous blog post where I have briefly how to deploy PowerShell script as Win32 App.

PowerShell Scripts

An intelligent script to rename the device as per organization’s device naming convention can be deployed directly to an Azure AD group. Like PowerShell script deployed as Win32 App, this also mitigates naming constraints with other device naming method we discussed earlier. A reboot is required for the changes to take effect. Please refer this link on how to deploy PowerShell scripts using Intune.

https://docs.microsoft.com/en-us/mem/intune/apps/intune-management-extension

Few important point to be mentioned here:

  • This requires Intune Management extension (IME)
  • If the script fails, Intune Management Extension 3 consecutive times when IME checks-in
  • Script does not execute again unless the script or the policy is modified, so please make sure devices are not inadvertently renamed when you make any change

I hope this post has been helpful to you. Please feel free to reach out if you have any further questions/comments/feedback.

Thank you.

Thanks for Sharing :)

Leave a Reply