Bulk Remove Autopilot DisplayName Property
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.
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”`
Once the script has complete you will have a log created in your specified location which will look something like this.
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.
Categories
Tags
Bulk Remove Autopilot DisplayName Property
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.
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”`
Once the script has complete you will have a log created in your specified location which will look something like this.
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.