You come into the office Monday morning to find someone deleted your AD machine account. First, it’s no surprise as it is Monday. Rather than logging in locally to re-join the domain, you can use the Restore-ADObject PowerShell cmdlet to quickly restore the account.
Verify the machine account exists in the Deleted Objects container:
*replace Domain and ComputerName
Get-ADObject -SearchBase “CN=Deleted Objects,DC=Domain,DC=com” -ldapFilter:”(msDs-lastKnownRDN=ComputerName)” -IncludeDeletedObjects -Properties *
Restore the deleted machine account:
*replace Domain and ComputerName
Get-ADObject -SearchBase “CN=Deleted Objects,DC=Domain,DC=com” -ldapFilter:”(msDs-lastKnownRDN=ComputerName)” -IncludeDeletedObjects | Restore-ADObject
You see…the day is already looking better.
BubBBBBA - You Rock!!!