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...
GrantBradley
Apr 22, 2019Copper Contributor
Hi Guys
thanks for the advise on the issues are they any other ways you know of bulk removing devices from azure i see i can remove it from intune via powershell or rule but are they anything for azure ad
Thanks
Grant
Ethan Stern
Apr 22, 2019Iron Contributor
GrantBradley Hi Grant, there are some cmdlets for removing from Azure AD- https://docs.microsoft.com/en-us/powershell/module/msonline/remove-msoldevice?view=azureadps-1.0
Is that what you were thinking of?
- GrantBradleyApr 23, 2019Copper Contributor
hi Ethan
i am already aware of that currently it is handy for removing one device but i am looking to remove in bulk if that is possible as devices have built over time and had not been removed
Thanks
Grant
- almennnApr 23, 2019Brass Contributor
Hi GrantBradley,
You could do something like this in PowerShell to delete stale devices from AAD:
$dt = [datetime]’2018/12/12’
Get-MsolDevice -All -LogonTimeBefore $dt | select-object -Property DeviceId | foreach {$_.DeviceID} | foreach {$_.Guid} | Remove-MsolDevice -Force
This gets and deletes all devices with a timestamp older than specific date. You can see more information in the doc I provided earlier.