Bulk Remove Autopilot DisplayName Property

Published On: November 10, 2022Last Updated: January 11, 2024By Tags: 1.8 min readViews: 293

TOC

Often, during the initial adoption of Microsoft Intune you will see organisations and admins try and maintain some of their technical debt of old. One of those areas is often the device naming conventions. In the modern management world, tracking assets via this method is long out dated, and if you are using Hybrid Azure AD Joined Devices you end up with an entirely new challenge on your hands anyway.

This post is aimed at organisations and admins who have decided to remove some of this technical debt and move towards using the options available within the Deployment Profiles for Autopilot.

In this post we will be using a PowerShell Script with the Microsoft.Graph module to achieve our goal and also take a backup of the devices previously specified DisplayNames.

You can obtain the script we will use from my Git Repo by using the link below.


Assumptions and Getting Started

The current script will remove ALL Display Names from devices within your tenant, by all means customise the logic to ensure this only handles devices in an array etc, but my need was to remove this from the entire fleet of devices on a tenant.

An assumption is made that you have devices that devices have the following value set on their Autopilot entity.

assumption gs
assumption gs

There is also an Assumption that you have the relevant rights to perform this action and also grant application consent to run the PowerShell script.


Running the Script

This part is fairly simple, however you will need to run this under a PowerShell session that is at least in bypass mode. My recommendation instead of changing the execution policy for PowerShell in its entirety is to run it with the following command in an elevated PowerShell prompt.

`powershell.exe -executionpolicy Bypass -File “Remove-AutopilotDisplayNameProperty.ps1” -LogOutputLocation “$env:ProgramDataLogs”`

removeidentities
removeidentities

Once the script has complete you will have a log created in your specified location which will look something like this.

rmidenlogoutput
rmidenlogoutput

Conclusion

I hope this script can prove useful to you, your peers and also your organisation. Please don’t forget to comment and or provide feedback below.

Bulk Remove Autopilot DisplayName Property

Published On: November 10, 2022Last Updated: January 11, 2024By Tags: 1.8 min readViews: 293

TOC

Often, during the initial adoption of Microsoft Intune you will see organisations and admins try and maintain some of their technical debt of old. One of those areas is often the device naming conventions. In the modern management world, tracking assets via this method is long out dated, and if you are using Hybrid Azure AD Joined Devices you end up with an entirely new challenge on your hands anyway.

This post is aimed at organisations and admins who have decided to remove some of this technical debt and move towards using the options available within the Deployment Profiles for Autopilot.

In this post we will be using a PowerShell Script with the Microsoft.Graph module to achieve our goal and also take a backup of the devices previously specified DisplayNames.

You can obtain the script we will use from my Git Repo by using the link below.


Assumptions and Getting Started

The current script will remove ALL Display Names from devices within your tenant, by all means customise the logic to ensure this only handles devices in an array etc, but my need was to remove this from the entire fleet of devices on a tenant.

An assumption is made that you have devices that devices have the following value set on their Autopilot entity.

assumption gs
assumption gs

There is also an Assumption that you have the relevant rights to perform this action and also grant application consent to run the PowerShell script.


Running the Script

This part is fairly simple, however you will need to run this under a PowerShell session that is at least in bypass mode. My recommendation instead of changing the execution policy for PowerShell in its entirety is to run it with the following command in an elevated PowerShell prompt.

`powershell.exe -executionpolicy Bypass -File “Remove-AutopilotDisplayNameProperty.ps1” -LogOutputLocation “$env:ProgramDataLogs”`

removeidentities
removeidentities

Once the script has complete you will have a log created in your specified location which will look something like this.

rmidenlogoutput
rmidenlogoutput

Conclusion

I hope this script can prove useful to you, your peers and also your organisation. Please don’t forget to comment and or provide feedback below.