In this post I will show you how to apply computer name based upon country location for Windows Autopilot devices. This can easily be achieved by using Group Tag which is also known as Order ID. Once we or vendor uploads the hardware hash to Intune portal, we can utilise specific naming convention to be used which will help us creating Deployment profiles to use desired hostname for the device we are looking for. Based upon group tag, we can further create Dynamic groups (country based) which will be used for targeting deployment profiles.

Differentiate devices using Group tag feature

When we buy device from 3rd party OEM / reseller such as Dell, Lenovo etc, they usually upload the hardware hash of the device which consists of following column name:

  • Device Serial Number
  • Windows Product ID
  • Hardware Hash

Along with that, they usually upload PurchaseOrderID as well. But we are interested in another column ie. OrderID which is also known as “Group Tag”. We can ask the OEM / Reseller to upload the OrderID for each specific device and we can instruct them to follow specific naming convention based upon where those devices will be used.

Modifying the Group Tag is just not limited to OEM during uploading hardware hash, this can be done at later stage also when devices are already uploaded to MEM Admin center. I will show you how to do this.

Create Group Tag based upon Country

For demonstration purpose, let’s say I have 2 devices. I need different naming convention for each. Something like this:

  • For Australia: AU+SerialNumber

We will be using Group Tag as AutoPilot-AU

  • For Singapore: SG+SerialNumber

We will be using Group Tag as AutoPilot-SG

Assuming that Import of hardware hash has been done into Intune using PowerShell or by OEM/Reseller. Login to MEM Admin Center and navigate to Devices > Enroll devices and under “Windows Autopilot Deployment Program” click on Devices.

Highlighted 2 devices, I will be making changes for Group Tag.

Select 1st device and assign the user to it which has valid Intune license.

Autopilot Assign user
AutopilotCompNameBasedOnCountry 02

Click on the device again to open its properties, under Group Tag specify the name as AutoPilot-AU and save the settings.

Autopilot Assign Group tag

For 2nd device, assign the license and specify Group Tag AutoPilot-SG.

Windows Autopilot Assign Order ID

Create 2 Dynamic Groups based upon Group Tag name

Navigate to groups and click on New Group.

Specify name as Dynamic Autopilot AU, select membership type as Dynamic Device.

Dynamic Autopilot OrderID

Under “Dynamic device members” click on Add dynamic query.

Under Configuration Rules > Rule syntax, click on Edit.

Dynamic membership rules

Under Rule syntax, specify following query:

(device.devicePhysicalIds -any (_ -eq "[OrderID]:AutoPilot-AU"))
OrderID rule syntax

Note: OrderID is the “Group Tag” info we provided previously for the device. We are creating a dynamic group which will have all the members / devices having Group ID set to “AutoPilot-AU

You may verify the results by clicking on Validate Rules which will help you analyse if query is working properly to display the selected device as part of the query.

AutopilotCompNameBasedOnCountry 08

Click on Save.

Create Dynamic Group for Country Singapore

Sameway create the Dynamic group for Singapore with following query:

(device.devicePhysicalIds -any (_ -eq "[OrderID]:AutoPilot-SG"))

Create Autopilot Deployment profiles for each based upon Country

We are now going to create Dynamic Profile for each “Group Tag”.

Navigate to Devices > Enroll Devices > Windows Autopilot Deployment Profiles and click on Create profile and select Windows PC.

AutopilotCompNameBasedOnCountry 09
AutopilotCompNameBasedOnCountry 10

Specify name as AzureADJoin Australia and click Next.

Under Out-of-box experience (OOBE), there are several settings. For naming convention I am specifically interested into Apply device name template change its value to Yes.

Microsoft provides 2 kinds of naming convention standards:

  • Serial number: Based upon serial number, we can use variable as %SERIAL%
  • Random number: This generates random number, we can specify the length of random number by using variable %RAND:11%, which means random character of 11 digits.

Ideally Serial Number is the best practice to follow keeping in mind characters not to extend more than 15.

AutopilotCompNameBasedOnCountry 11

I would like to use naming convention as AU%SERIAL%, but as I am testing on Virtual machine where serial number length is more than 15, autopilot process will fail.

Hence, for demonstration purpose, I am using AU%RAND:11%.

Check the link for step by step guide on Windows autopilot

Under Scope tags, create Next.

Under Assignments, assign the profile to Dynamic Autopilot-AU group which we previously created, click Next.

AutopilotCompNameBasedOnCountry 12

Under Review + create, verify the settings and click on Create.

AutopilotCompNameBasedOnCountry 13

This will create the appropriate naming convention we are looking for and will only be targeted to Devices where we have specified “Group Tag” related to Australia.

Create another Autopilot Deployment profile with the name AzureADJoin Singapore and provide “Apply device name template” as SG%RAND:11%. Target this to Dynamic Group Dynamic Autopilot-SG

Verify Windows Autopilot configuration

Initiate the Windows Autopilot on both the device, once device goes through OOBE phase and configuration, we will see the correct naming conventions are getting applied to the device.

AutopilotCompNameBasedOnCountry 14