Wednesday, July 9, 2014

Recovering from Accidentally Deleted AD objects with PowerShell , AD Recycle BIN , Windows 2012 Active Directory.

We will recovery accidently deleted user account via PS in windows 2012 domain environment. To prepare the scenario we will fist delete the user and recovery it.

Log onto  Windows 2012 DC with administrator privileges.Open PS with administrator privileges

Type following.

Get-ADUser -Filter 'Name -like "*C-Ron Buzon"'

image

image

We will delete the user

Get-ADUser -Filter 'Name -like "*C-Ron Buzon"' | Remove-ADUser -Confirm:$false

image

user has been deleted

image

we can see user within the Deleted Objects container in ADAC

image

Get-ADobject -Filter 'Name -like "*C-Ron*"' -IncludeDeletedObjects

image

we will restore this user

Get-ADobject -Filter 'Name -like "*C-Ron*"' -IncludeDeletedObjects | Restore-ADObject

image

if I check to see user is back to ADDS

image

image

Read more

Respectfully,
Oz Casey, Dedeal ( MVP north America)
MCITP (EMA), MCITP (SA)
MCSE 2003, M+, S+, MCDST
Security+, Project +, Server +
http://smtp25.blogspot.com/ (Blog)
http://telnet25.wordpress.com/ (Blog)

 

No comments: