Transcript – how restore AD Object from recycle bin – S2K8 R2

**********************

Windows PowerShell Transcript Start

Start time: 20120313094724

Username  : VDI\amasv

Machine                : DCHV (Microsoft Windows NT 6.1.7600.0)

**********************

Transcript started, output file is C:\Users\amasv\Documents\PowerShell_transcri

pt.20120313094724.txt

PS C:\Windows\system32> Get-ADObject -SearchBase „cn=Deleted Objects,DC=vdi,DC=fujitsu,DC=lab“ -Filter {lastKnownParent -eq „OU=accounts,DC=vdi,DC=fujitsu,DC=lab“} -IncludeDeletedObjects

 

 

Deleted           : True

DistinguishedName : CN=martin skapa\0ADEL:704fed33-f62c-4401-9d4b-760748508fb1,

CN=Deleted Objects,DC=vdi,DC=fujitsu,DC=lab

Name              : martin skapa

DEL:704fed33-f62c-4401-9d4b-760748508fb1

ObjectClass       : user

ObjectGUID        : 704fed33-f62c-4401-9d4b-760748508fb1

 

Deleted           : True

DistinguishedName : CN=martina R.\0ADEL:0295617c-30aa-4ef2-bc19-5191714752

94,CN=Deleted Objects,DC=vdi,DC=fujitsu,DC=lab

Name              : martina R.

DEL:0295617c-30aa-4ef2-bc19-519171475294

ObjectClass       : user

ObjectGUID        : 0295617c-30aa-4ef2-bc19-519171475294

 

 

 

PS C:\Windows\system32> Get-ADObject -SearchBase „cn=Deleted Objects,DC=vdi,DC=fujitsu,DC=lab“ -Filter {lastKnownParent -eq „OU=accounts,DC=vdi,DC=fujitsu,DC=lab“} -IncludeDeletedObjects | Restore-ADObject

or simple command

Get-ADobject -filter {displayName -eq „martin“ } -includeDeletedObjects | Restore-ADObject

PS C:\Windows\system32> Stop-Transcript

**********************

Windows PowerShell Transcript End

End time: 20120313094801

**********************