Bulk Update Primary User for Intune Devices

In modern workplaces, laptop, tablet, mobile devices have become an essential part of the work environment. It’s crucial to have a mobile device management solution in place to ensure the security and compliance of company data. Microsoft Intune is a popular solution for managing mobile devices, allowing IT administrators to control access and protect corporate resources.

One of the critical features of Intune is the ability to manage device enrollment and assign primary users to devices. The primary user is the user who has ownership of the device, and all device policies are applied based on the primary user. In many cases, organizations may need to change the primary user of multiple devices simultaneously (this happens mainly for laptops built by helpdesk as their user id becomes primary user instead of actual user).

Bulk update can be done through PowerShell Magic that I am sharing in this Post.

Prerequisites for this solution:

Download the solution from below git hub link: (bulkupdateprimaryuser.ps1)


Download the solution from PowerShell Gallery:


Install-Script -Name bulkupdateprimaryuser

Note: You need to setup AzureAD app registration and certificate based authentication with appropriate permissions on Intune devices.

Now update the below part of the script:

Script will run as .\
bulkupdateprimaryuser.ps1 –
csvfilepath .\PrimarUserData.csv

Here is the CSV file format I am using, you can update the script and use accordingly

Script will create a report of success and failure in the report folder and will generate the log under logs folder.

These folders will get created in the folder from where script is being run.

This is very common problem where Primary user is not the actual user because machine is being setup by helpdesk before providing it to user.

I hope this solution will help anyone looking for a bulk update of primary user.



Thanks for reading and downloading…

Tech Wizard




PowerShell Fast Track


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s