Recuperer les objets supprimes dans ADLDS 2008 R2 avec Powershell
Bonjour,
Dans l’article du mois d’octobre, je vous ai montré comment activer la fonction ‘recycle bin’ dans 2008 R2 via Powershell. Aujourd’hui, nous allons passer à la pratique avec un objet supprimé dans ADLDS 2008 R2.
Suppose qu’on a supprimé accidentellement le compte utilisateur “user2” , et que l’on veut maintenant le récupérer. Pour cela on recherche les objets supprimés dans ADLDS avec cette commande :
-searchBase = précise l’endroit où on veut faire la recherche, ici c’est la partition applicative “DC=universe,DC=com”
-server = précisele serveur et le port LDAP de l’instance ADLDS
-includeDeletedObjects = précise que l’on veut chercher également les objets supprimés, par défaut il ne cherche pas les objets supprimés
get-adobject -filter "*" -searchbase "dc=universe,dc=com" -server "machine:50000" -IncludeDeletedObjects | ft -A
Deleted DistinguishedName Name ObjectClass ObjectGUID
------- ----------------- ---- ----------- ----------
DC=universe,DC=com universe domainDNS a40f08ac-f08a-49bf-ac85-2002aab16de4
True CN=Deleted Objects,DC=universe,DC=com Deleted Objects container 242ab687-fbd9-447b-9422-7a543510bee8
True CN=user2\0ADEL:e898b0a0-19b3-4e3a-8765-d5e36aee4af5,CN=Deleted Objects,DC=universe,DC=com
user2... user e898b0a0-19b3-4e3a-8765-d5e36aee4af5
CN=LostAndFound,DC=universe,DC=com LostAndFound lostAndFound 177d7450-0d0b-404a-8348-6ef47b5b505d
CN=NTDS Quotas,DC=universe,DC=com NTDS Quotas msDS-QuotaContainer 2e422e5e-481a-4a77-ad84-191b8646e268
CN=Roles,DC=universe,DC=com Roles container f3f2720a-1b5f-4f55-bb89-04ed8cbef976
CN=Administrators,CN=Roles,DC=universe,DC=com
Administrators group ed5b5462-270c-44d2-8db5-daf142633cdd
CN=Users,CN=Roles,DC=universe,DC=com Users group 9aa91f9b-a64e-4f35-a40e-1b9051c5f232
CN=Readers,CN=Roles,DC=universe,DC=com Readers group bb67b0f3-10f9-41a0-9d5c-4e169a7f45eb
OU=OU1,DC=universe,DC=com OU1 organizationalUnit d7cbf694-6286-42b8-9a91-dca888e3a0e3
CN=u1,OU=OU1,DC=universe,DC=com u1 user 64b2247d-35ed-4d89-9123-0feb852f3f49
On va utiliser la commande “Restore-ADObject” suivante avec les options “-newName” pour définir le nom restauré, et “-targetPath” pour préciser où on veut le déposer.
restore-adobject -identity "CN=user2\0ADEL:e898b0a0-19b3-4e3a-8765-d5e36aee4af5,CN=Deleted Objects,DC=universe,DC=com" -newName "user2" -targetPath "OU=OU1,DC=universe,DC=com" -server "machine:50000"
Maintenant, on va vérifier si l’objet “user2” est bien restauré.
get-adobject -filter "*" -searchbase "dc=universe,dc=com" -server "machine:50000" -IncludeDeletedObjects | ft –A
Deleted DistinguishedName Name ObjectClass ObjectGUID
------- ----------------- ---- ----------- ----------
DC=universe,DC=com universe domainDNS a40f08ac-f08a-49bf-ac85-2002aab16de4
True CN=Deleted Objects,DC=universe,DC=com Deleted Objects container 242ab687-fbd9-447b-9422-7a543510bee8
CN=LostAndFound,DC=universe,DC=com LostAndFound lostAndFound 177d7450-0d0b-404a-8348-6ef47b5b505d
CN=NTDS Quotas,DC=universe,DC=com NTDS Quotas msDS-QuotaContainer 2e422e5e-481a-4a77-ad84-191b8646e268
CN=Roles,DC=universe,DC=com Roles container f3f2720a-1b5f-4f55-bb89-04ed8cbef976
CN=Administrators,CN=Roles,DC=universe,DC=com Administrators group ed5b5462-270c-44d2-8db5-daf142633cdd
CN=Users,CN=Roles,DC=universe,DC=com Users group 9aa91f9b-a64e-4f35-a40e-1b9051c5f232
CN=Readers,CN=Roles,DC=universe,DC=com Readers group bb67b0f3-10f9-41a0-9d5c-4e169a7f45eb
OU=OU1,DC=universe,DC=com OU1 organizationalUnit d7cbf694-6286-42b8-9a91-dca888e3a0e3
CN=u1,OU=OU1,DC=universe,DC=com u1 user 64b2247d-35ed-4d89-9123-0feb852f3f49
CN=user2,OU=OU1,DC=universe,DC=com user2 user e898b0a0-19b3-4e3a-8765-d5e36aee4af5
Comments
- Anonymous
March 25, 2016
hai, I just want to tell you that I am just very new to blogs and seriously loved this website. More than likely I’m planning to bookmark your blog post .
You amazingly come with really good posts. Thanks a lot for sharing your blog Microsoft.
http://www.wisatasia.id/search/label/Wisata%20Kepulauan%20Riau
http://www.wisatasia.id/search/label/Wisata%20Komodo
http://www.wisatasia.id/search/label/Wisata%20Lombok
http://www.wisatasia.id/search/label/Wisata%20Makasar
http://www.wisatasia.id/search/label/Wisata%20Malang
http://www.wisatasia.id/search/label/Wisata%20Manado
http://www.wisatasia.id/search/label/Wisata%20Medan
http://www.wisatasia.id/search/label/Wisata%20Minahasa
http://www.wisatasia.id/search/label/Wisata%20Nusa%20Tenggara%20Barat
http://www.wisatasia.id/search/label/Wisata%20Nusa%20Tenggara%20Timur
http://www.wisatasia.id/search/label/Wisata%20Pantai
http://www.wisatasia.id/search/label/Wisata%20Pantai%20Malang
http://www.wisatasia.id/search/label/Wisata%20Papua
http://www.wisatasia.id/search/label/Wisata%20Pulau
http://www.wisatasia.id/search/label/Wisata%20Pulau%20Samalona
http://www.wisatasia.id/search/label/Wisata%20Pulau%20Siladen
http://www.wisatasia.id/search/label/Wisata%20Pulau%20Wayag
http://www.wisatasia.id/search/label/Wisata%20Pulau%20Weh%20Sabang
http://www.wisatasia.id/search/label/Wisata%20Puncak
http://www.wisatasia.id/search/label/Wisata%20Raja%20Ampat
http://www.wisatasia.id/search/label/Wisata%20Sulawesi%20dan%20Papua
http://www.wisatasia.id/search/label/Wisata%20Sulawesi%20Selatan
http://www.wisatasia.id/search/label/Wisata%20Sulawesi%20Utara
http://www.wisatasia.id/search/label/Wisata%20Sumatera
http://www.wisatasia.id/search/label/Wisata%20Sumatera%20Utara
http://www.wisatasia.id/search/label/Wisata%20Taman%20Nasional
http://www.wisatasia.id/search/label/Wisata%20Taman%20Safari
http://www.wisatasia.id/search/label/Wisata%20Tanjung%20Lesung
http://www.wisatasia.id/search/label/Wisata%20Trans%20Studio%20Bandung
http://www.wisatasia.id/search/label/Wisata%20Trans%20Studio%20Makasar
http://www.wisatasia.id/search/label/Wisata-Indonesia
http://www.wisatasia.id