How to unenroll windows device from Intune using PowerShell?

Anant Bera 86 Reputation points
2024-04-24T05:29:28.9233333+00:00

Hello Experts,

We have looking for some PowerShell script or command to unenroll the Windows device from Intune without user interaction. We are trying to enroll the device using the graph api query. we have deleted the device object from the managed device but it is not working, we are able to see the user account in the Work or school account.

Is there is any PowerShell command to simply unenroll Windows device from Intune ???

Thanks

Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,365 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,082 questions
0 comments No comments
{count} votes

Accepted answer
  1. Crystal-MSFT 43,381 Reputation points Microsoft Vendor
    2024-04-24T05:58:05.79+00:00

    @Anant Bera, Thanks for posting in Q&A. To remove the device from Intune via PowerShell script, we can run the following script. For the script, it deletes the device in Intune portal. After the deletion, the device will not be managed by Intune.

    https://www.fisontech.net/p/day-57-remove-intune-devices-with-powershell/

    Note: Non-Microsoft link, just for the reference.

    But the account on the device side will be still kept. To remove it, you can run the following command to remove the account information.

    Get-ItemProperty -Path "C:\Users\*\AppData\Local\Packages" | ForEach-Object { Remove-Item -Path "$_\Microsoft.AAD.BrokerPlugin*" -Recurse -Force | Out-Null }
    
    

    https://answers.microsoft.com/en-us/windows/forum/all/how-do-i-remove-a-work-or-school-account-from-my/58c72151-87e7-4f21-a41f-1cb59728f3d3

    You can try the above command and hope the above information can help.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful