Forum Discussion

Luke_Pulis's avatar
Luke_Pulis
Copper Contributor
Mar 24, 2020

How to recover or re-add device

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

12 Replies

  • Moe_Kinani's avatar
    Moe_Kinani
    Bronze Contributor
    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-deleted-devices

    • pnoorder60's avatar
      pnoorder60
      Copper Contributor

      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.

       

    • Luke_Pulis's avatar
      Luke_Pulis
      Copper Contributor

      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?

      • Moe_Kinani's avatar
        Moe_Kinani
        Bronze Contributor
        Correct.

        It’s the only workaround in your situation.

Resources