Link to home
Start Free TrialLog in
Avatar of Joseph Daly
Joseph DalyFlag for United States of America

asked on

Active Directory restoration of deleted computer account with Restore-ADobject cmdlet

Someone at some point deleted one of our servers from active directory which i just noticed today. I have ran the powershell to search the deleted items container and found the object there. We do not have the recyling bin enabled so I will need to use the powershell to do this.

The command I am running to find the computer object is as follows.

get-adobject -filter 'isDeleted -eq $true' -IncludeDeletedObjects | where-object {$_.name -like "servername*" -and $_.objectclass -eq "computer"}

This returns a single object of the computer account.

Now to restore it I can simply pipe to restore-Adobject

get-adobject -filter 'isDeleted -eq $true' -IncludeDeletedObjects | where-object {$_.name -like "boslitfs02*" -and $_.objectclass -eq "computer"}  | restore-adobject

Is there anything else needed or any issues I may run into? I usually would just disjoin/rejoin domain for this type of issue but this server is taking part in a DFS namespace.

Any help is appreacited.
ASKER CERTIFIED SOLUTION
Avatar of Dan McFadden
Dan McFadden
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial