PowerShell Logo Small

Restore-ADObject



This is the built-in help made by Microsoft for the command 'Restore-ADObject', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Restores an Active Directory object.

SYNTAX


Restore-ADObject [-Identity] <ADObject> [-AuthType {Negotiate | Basic}] [-Credential <PSCredential>] [-NewName <String>] [-Partition <String>] [-PassThru] [-Server <String>]
[-TargetPath <String>] [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Restore-ADObject cmdlet restores a deleted Active Directory object.


The NewName parameter specifies the new name for the restored object. If the NewName parameter is not specified, the value of the Active Directory attribute with an LDAP
display name of msDS-lastKnownRDN is used. The TargetPath parameter specifies the new location for the restored object. If the TargetPath is not specified, the value of the
Active Directory attribute with an LDAP display name of lastKnownParent is used.


The Identity parameter specifies the Active Directory object to restore. You can identify an object by its distinguished name (DN) or GUID. You can also set the Identity
parameter to an object variable such as $<localObject>, or you can pass an object through the pipeline to the Identity parameter. For example, you can use the Get-ADObject
cmdlet to retrieve a deleted object by specifying the IncludeDeletedObjects parameter. You can then pass the object through the pipeline to the Restore-ADObject cmdlet.


Note: You can get the distinguished names of deleted objects by using the Get-ADObject cmdlet with the IncludeDeletedObjects parameter specified.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=291104
Get-ADObject
Move-ADObject
New-ADObject
Remove-ADObject
Rename-ADObject
Set-ADObject

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>Restore-ADObject -Identity "613dc90a-2afd-49fb-8bd8-eac48c6ab59f" -NewName "Kim Abercrombie" -TargetPath "OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM"



This command restores the ADObject while setting the msDS-LastKnownRDN attribute of the deleted object to NewName parameter and setting the lastKnownRDN to the TargetPath
parameter.




-------------------------- EXAMPLE 2 --------------------------

PS C:\>Restore-ADObject -Identity "CN=Kim Abercrombie\0ADEL:613dc90a-2afd-49fb-8bd8-eac48c6ab59f,CN=Deleted Objects,DC=FABRIKAM,DC=COM" -NewName "Kim Abercrombie"
-TargetPath "OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM"



This command restores the ADObject while setting the msDS-LastKnownRDN attribute of the deleted object to NewName parameter and setting the lastKnownRDN to the TargetPath
parameter.




-------------------------- EXAMPLE 3 --------------------------

PS C:\>Get-ADObject -Filter 'samaccountname -eq "kimabercrombie"' -IncludeDeletedObjects | Restore-ADObject



This command finds a deleted user whose samaccountname is kimabercrombie, and restores it.




-------------------------- EXAMPLE 4 --------------------------

PS C:\>Restore-ADObject -Identity '6bb3bfe9-4355-48ee-b3b6-4fda6917d31d' -Server server1:50000



This command restores an AD-LDS object using ObjectGUID.




-------------------------- EXAMPLE 5 --------------------------

PS C:\>Get-ADObject -Filter 'msds-lastknownrdn -eq "user1"' -Server server1:50000 -IncludeDeletedObjects -SearchBase "o=app1,c=us" | Restore-ADObject



This command restores an AD-LDS object using msds-LastKnownRDN.