Forum Discussion
GrantBradley
Apr 18, 2019Copper Contributor
Device - Removal
hi Guys Hope someone can help i am looking to removed retired devices from Intune and from Azure AD , i know they are a powershell script any advise would be great , even if you can point a scri...
mark-derouen
May 10, 2022Brass Contributor
I needed to deleted all personal windows devices from Intune
I used the following command to get a list of all personally owned windows 10 devices.
Get-IntuneManagedDevice | Get-MSGraphAllPages | Out-GridView
Next I took the list of id's for the devices I needed and used the code below to delete them.
Connect-msgraph
# List of device id's to delete
$ids = get-content "C:\temp\ManagedDeviceIDs.txt"
Foreach ($id in $ids)
{
Write-host " Deleting DeviceName: $id"
Remove-IntuneManagedDevice –managedDeviceId $id –Verbose –ErrorAction Stop
}
Pretty simple stuff. Took me forever to figure it out. Hope this helps someone.
I used the following command to get a list of all personally owned windows 10 devices.
Get-IntuneManagedDevice | Get-MSGraphAllPages | Out-GridView
Next I took the list of id's for the devices I needed and used the code below to delete them.
Connect-msgraph
# List of device id's to delete
$ids = get-content "C:\temp\ManagedDeviceIDs.txt"
Foreach ($id in $ids)
{
Write-host " Deleting DeviceName: $id"
Remove-IntuneManagedDevice –managedDeviceId $id –Verbose –ErrorAction Stop
}
Pretty simple stuff. Took me forever to figure it out. Hope this helps someone.