POWERSHELL

Powershell script to restore the AD User/computer account in AD after the specified timeline.

$ChangeDate = New-Object DateTime(2019, 4, 15, 12, 00, 02)
Get-ADObject -filter ‘whenChanged -gt $ChangeDate -and isDeleted -eq $true’ -IncludeDeletedObjects -properties * | Foreach-Object {Restore-ADObject $_.objectguid -NewName $_.SamAccountName -TargetPath $_.LastKnownParent}

Leave a Reply

Your email address will not be published. Required fields are marked *