In the management of the domain, it is possible to mistakenly delete the user, group, OU and other objects, through some methods we can restore these objects. When you delete a user account, the account is not immediately deleted from the Active Directory database, but is transferred to a hidden folder named Deletedobject in the Active Directory database, Windows Server 2003 The default for later versions of SP1 is 180 days after it is completely removed, the previous version of the system is only 60 days.
There is an Active Directory Recycle Bin in the new features of Windows Server2008 R2, but it is turned off by default, so if you want to use the Active Directory Recycle Bin, enable it first.
Note: After the ActiveDirectory Recycle Bin function is turned on, it cannot be turned off (irreversible).
Prerequisite:
the forest domain functional level is Windows Server R2
To use the command to open the Active Directory Recycle Bin Step reference:
1. In ad DS Open on server" for windows PowerShell ad module "
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/83/A0/wKiom1d4vwfTAxIuAACwvOwkp-Y005.jpg-wh_500x0-wm_3 -wmp_4-s_2526478089.jpg "style=" Float:none; "title=" 2016-07-03_14-13-29.jpg "alt=" Wkiom1d4vwftaxiuaacwvowkp-y005.jpg-wh_50 "/>
2. use the "get-adforest" command to view the domain functional level
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/83/9E/wKioL1d4vwfh-NG0AADIWZZjqBY327.jpg-wh_500x0-wm_3 -wmp_4-s_2139364121.jpg "style=" Float:none; "title=" 2016-07-03_14-29-19.jpg "alt=" Wkiol1d4vwfh-ng0aadiwzzjqby327.jpg-wh_50 "/>
3. Use theget-addomaincommand to view the forest functional level
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/83/A0/wKiom1d4vwnBZbitAAEpg5gdYXs934.jpg-wh_500x0-wm_3 -wmp_4-s_3795516945.jpg "style=" Float:none; "title=" 2016-07-03_14-29-42.jpg "alt=" Wkiom1d4vwnbzbitaaepg5gdyxs934.jpg-wh_50 "/>
4. use the "get-adoptionalfeature-filter {name-like" * "}" command to see if the AD Recycle Bin feature is turned on, empty indicates that it is not turned on
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/83/9E/wKioL1d4vwmT18tNAADUFgnqbwE392.jpg-wh_500x0-wm_3 -wmp_4-s_3625716587.jpg "style=" Float:none; "title=" 2016-07-03_14-31-06.jpg "alt=" Wkiol1d4vwmt18tnaadufgnqbwe392.jpg-wh_50 "/>
5.Use theenable-adoptionalfeature–identity ' cn=recycle Bin feature,cn=optional features,cn=directoryservice,cn=windows nt,cn=services,cn=configuration,dc=contoso,dc=Local' –scope forestorconfigurationset–target ' contoso.Local'the command opensADRecycling Station
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/83/A0/wKiom1d4vwqyjXa6AAEBjPzyRgg849.jpg-wh_500x0-wm_3 -wmp_4-s_930327172.jpg "style=" Float:none; "title=" 2016-07-03_14-41-47.jpg "alt=" Wkiom1d4vwqyjxa6aaebjpzyrgg849.jpg-wh_50 "/>
6. enter "Y"
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/83/A0/wKiom1d4vwvyaOZHAADkvkkzchI175.jpg-wh_500x0-wm_3 -wmp_4-s_2307394559.jpg "style=" Float:none; "title=" 2016-07-03_14-42-09.jpg "alt=" Wkiom1d4vwvyaozhaadkvkkzchi175.jpg-wh_50 "/>
7. Check The status of the AD Recycle Bin and have successfully opened
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/83/9E/wKioL1d4vwuAYoXaAAEwlvsBArs564.jpg-wh_500x0-wm_3 -wmp_4-s_2912291096.jpg "style=" Float:none; "title=" 2016-07-03_14-43-05.jpg "alt=" Wkiol1d4vwuayoxaaaewlvsbars564.jpg-wh_50 "/>
8. Delete test1 account
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/83/A0/wKiom1d4vwywY7hXAADTKaLVcKc600.jpg-wh_500x0-wm_3 -wmp_4-s_2785595578.jpg "style=" Float:none; "title=" 2016-07-03_14-46-13.jpg "alt=" Wkiom1d4vwywy7hxaadtkalvckc600.jpg-wh_50 "/>
using ' "Command to view test1 user state, deleted true
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/83/9E/wKioL1d4vwzQCEXjAACuHHaXieQ909.jpg-wh_500x0-wm_3 -wmp_4-s_1286168766.jpg "style=" Float:none; "title=" 2016-07-03_14-48-30.jpg "alt=" Wkiol1d4vwzqcexjaacuhhaxieq909.jpg-wh_50 "/>
Ten. using "get-adobject-searchscope subtree-filter {displayname-eq" test1 "}-includedeletedobjects | Restore-adobject "command to restore Test1 account
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/83/A0/wKiom1d4vw2R9e2uAACkFwCTAYI414.jpg-wh_ 500x0-wm_3-wmp_4-s_3339956400.jpg "style=" Float:none; "title=" 2016-07-03_14-49-45.jpg "alt=" Wkiom1d4vw2r9e2uaackfwctayi414.jpg-wh_50 "/>
open aduc view test1 account status, test1 successfully restored
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/83/9E/wKioL1d4vw3DVsVrAACcZKvyyFo414.jpg-wh_500x0-wm_3 -wmp_4-s_2014905148.jpg "style=" Float:none; "title=" 2016-07-03_14-50-06.jpg "alt=" Wkiol1d4vw3dvsvraacczkvyyfo414.jpg-wh_50 "/>
Delete test this OU
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/83/A0/wKiom1d4vw2yJHXaAADDwBVVXEM765.jpg-wh_500x0-wm_3 -wmp_4-s_3147597679.jpg "style=" Float:none; "title=" 2016-07-03_14-50-25.jpg "alt=" Wkiom1d4vw2yjhxaaaddwbvvxem765.jpg-wh_50 "/>
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/83/9E/wKioL1d4vw6yafOLAADH5S4aacU088.jpg-wh_500x0-wm_3 -wmp_4-s_4276789587.jpg "style=" Float:none; "title=" 2016-07-03_14-50-45.jpg "alt=" Wkiol1d4vw6yafolaadh5s4aacu088.jpg-wh_50 "/>
13. Use "Get-adobject-ldapfilter:" (msds-lastknownrdn=test) "–includedeletedobjects | Restore-adobject "command to restore Test this OU
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/83/9E/wKioL1d4vw7QljC7AABgOd5A6Nc553.jpg-wh_500x0-wm_3 -wmp_4-s_2211437974.jpg "style=" Float:none; "title=" 2016-07-03_15-26-57.jpg "alt=" Wkiol1d4vw7qljc7aabgod5a6nc553.jpg-wh_50 "/>
14. aduc test this ou , successfully restored
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/83/A0/wKiom1d4vw_xJdX4AAC30HUc8GI869.jpg-wh_500x0-wm_3 -wmp_4-s_1324577037.jpg "style=" Float:none; "title=" 2016-07-03_15-27-13.jpg "alt=" Wkiom1d4vw_ Xjdx4aac30huc8gi869.jpg-wh_50 "/>
15.use "get-adobject-searchbase" cn=deleted objects,dc=contoso,dc=Local"-filter {lastknownparent-eq" ou=Test, dc=contoso,dc=Local"}-includedeletedobjects | Restore-adobject "Command RecoveryTestthisOUAll users under
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/83/A0/wKiom1d4vw-hCecYAACTXo9Ayk8247.jpg-wh_ 500x0-wm_3-wmp_4-s_1371383771.jpg "style=" Float:none; "title=" 2016-07-03_15-28-14.jpg "alt=" Wkiom1d4vw-hcecyaactxo9ayk8247.jpg-wh_50 "/>
aduc test this ou
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/83/9E/wKioL1d4vzDjlcsmAACxtmq-GHs033.jpg-wh_500x0-wm_3 -wmp_4-s_1230937119.jpg "title=" 2016-07-03_15-28-29.jpg "alt=" Wkiol1d4vzdjlcsmaacxtmq-ghs033.jpg-wh_50 "/>
Open with Command AD The Recycle Bin has been completed.
This article is from the "Lizm" blog, make sure to keep this source http://lizmfinder.blog.51cto.com/6421311/1795318
Windows Server R2 Recycle Bin (command)