How to recover or re-add device

Copper Contributor

Hi, 

To try and make a long story short, I have 2 devices, Device 1 one belonged to me and Device 2 belonged to someone previously. I had taken Device 2 because the specs we're better and am giving Device 1 to a new-hire. My initial thought was to delete Device 1 and just re-add it to Azure AD under the new owner. After I had done that I came across an extremely simple PowerShell cmdlet that made adding a new owner and removing the old owner very fast and painless. I used this cmdlet to add me as the new owner of Device 2 but had already deleted Device 1. I'm now stuck trying to figure out how to get Device 1 back into AD and change the owner. How can I do this?

Thanks

11 Replies
Hi Luke,

I have been in the same boat sometime ago. Recycle bin is not yet supported and you can’t recover deleted devices, it’s a feature that MSFT working on.

All the devices stays on soft delete for 30 days, I know because when I delete a device from Azure AD, It stays in PowerBI report for 30 days.

Have you tried the ps below to add the device manually?

PS C:\>New-AzureADDevice -AccountEnabled $true -DisplayName "My new device" -DeviceId $guid -DeviceOSType "OS" -DeviceOSVersion "1.1"


https://feedback.azure.com/forums/169401-azure-active-directory/suggestions/32127307-recycle-bin-for...

Hi, @Moe_Kinani 

From looking at the command I assume this makes a spare device on AD to which I can then add the device to the already existing user?

Correct.

It’s the only workaround in your situation.

I was able to resolve this using the following steps:

For Azure AD joined devices Windows 10 devices, take the following steps:

Open the command prompt as an administrator
Enter dsregcmd /forcerecovery (You need to be an administrator to perform this action).
Click “Sign in” in the dialog that opens up and continue with the sign in process.
Sign out and sign in back to the device to complete the recovery.

https://docs.microsoft.com/en-us/azure/active-directory/devices/faq

Just for good measure I gave user temporarly administrator priviledges & followed the steps initially to remove the device

e.g.

1) dsregcmd /debug /leave
2) Reboot
3) Add user to local-admins
4) Log-off & on again
5) dsregcmd /forcerecovery (I was unable to use the GUI, it did not “work” e.g. no sign-in screen showed.)

 

I used this for:

 

Fix Office 365 Error 70003: Your Organization Has Deleted This Device - Technipages

 

It might resolve your issue aswell

I deleted the device from my AzureAD and wanted the new named device to show here and the above solution worked for me. thank you.
me too!
I had a similar problem with a computer where the device had been deleted on AzureAD by mistake. Found using "dsregcmd /forcerecovery" worked for me.

Was a few seconds away from resetting the PC as nothing else had worked when I spotted this suggestion. Saved me a lot of time and have made a note of the command in case it occurs on another device.

@Dutch2005nl

 

This saved me. I accidentally deleted a device from the admin portal and my employee could not recieve emails. The "dsregcmd /forcerecovery" wouldn't launch until the user was set up as an admin, and on a fresh restart. We are up and running now. Thank you!!!

dsregcmd /forcerecovery on the cmd line worked PERFECTLY! Thanks so much

@Dutch2005nlIt worked! Much thanks for being a life saver

@Moe_Kinani 

I needed to use the "Remote" solution that you have mentioned here. I was remote from the concerned Laptop. 

Your example helped me on the way, but had several questions on the Object details.
New-AzureADDevice -AccountEnabled $true -DisplayName "My new device" -DeviceId $guid -DeviceOSType "OS" -DeviceOSVersion "1.1"

For me, the hardest -Object (Like many others) was the mandatory -AlternativeSecurityIds $altsecids
So I added:
$key = [System.Text.Encoding]::Unicode.GetBytes("X509:<SHA1-TP-PUBKEY><Thumbprint>")
$altsecids = [PSCustomObject]@{key=$key;type='2'}

I also used OSType "Windows" and got a version number from another device. That did the trick and like magic the Laptop was able to login again via the original domein UserID. I'm not sure anymore where I have found all the pieces of this puzzle, but this worked form me.