Microsoft Entra Suite Tech Accelerator
Aug 14 2024, 07:00 AM - 09:30 AM (PDT)
Microsoft Tech Community
Rename Hybrid Joined Computers deployed via Autopilot
Published Sep 30 2019 04:19 PM 17.6K Views

Traditionally, IT pros spend a lot of time building and customizing images that will later be deployed to devices. Windows Autopilot introduces a new approach.

From the user's perspective, it only takes a few simple operations to make their device ready to use.

From the IT pro's perspective, the only interaction required from the end user is to connect to a network and to verify their credentials. Everything beyond that is automated.



One of the feature IT pros miss today (at the time of this post) is the standardization of the Computer Names when using Autopilot for Hybrid scenarios. The reason being the limited flexibility while creating the Domain Join configuration profile in Intune which is only allows a prefix followed by a random set of characters.



Product group is aware of this challenge and plans to make this more flexible in the near future.



As an interim measure, you can leverage on-premises solution like ConfigMgr to change the computer name.

An assumption to this workaround is you have already pushed the ConfigMgr agent on the target device. For guidance refer this post:


In this post I am showcasing the power of ConfigMgr Task Sequence to change the computer name.

  1. From the ConfigMgr console create a new custom task sequence.


  1. Give a Name and don’t need to choose any Boot Image


  1. Click Next to finish the Wizard.
  2. Edit the Task Sequence to add steps for customizations
  3. Click Add > General > Run PowerShell script





  1. Choose the radio option Enter a PowerShell script and click Add script


  1. Enter your PowerShell script to rename the Computer Account meeting company requirements.


In this example I am using a PowerShell script to change the computer name to its serial number. This is one of the most common asks. There are many references you can find from the Scripting Gallery, for this specific post I am referencing:



$serial = Get-WmiObject win32_bios | select -expand serialnumber

$ready = $serial -replace " ", ""

$number = [Microsoft.VisualBasic.Information]::isnumeric($ready)

If ($number -eq $True) {

$name = "UMS" + $ready.substring(0, [System.Math]::Min(12, $ready.length))


Elseif ($number -eq $False) {

$name = $ready.substring(0, [System.Math]::Min(15, $ready.length))


(Get-WmiObject Win32_ComputerSystem).Rename($name)


The sample script provided here is not supported under any Microsoft standard support program or service. All scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.


  1. Click OK to save your changes.
  2. Check the box Run this step as the following account
  3. Click the Set button to select an account with
    1. Rights to update Computer Account in Active Directory.
    2. Local admin on the machine.


  1. Add another Step to restart computer.
  2. Click Add > General > Restart Computer


  1. Set the option after restart to The currently installed default operating system and customize message as desired. Additionally you can also change the timeout seconds.


  1. Click OK to save


Your task sequence is now ready to be deployed to a Device Collection. To keep the things Dynamic, I created a dynamic Device Collection which is matching the Name-Prefix of my Hybrid Join Configuration Profile.




Once the device is renamed, AAD Connect will synchronize the new name in Azure AD and will be reflected in Intune and Azure portals.


There are many other ways to rename the computer without using ConfigMgr, I personally found this most secure without exposing any credentials.






Arnab Mitra


Version history
Last update:
‎Sep 30 2019 04:18 PM
Updated by: