PowerShell Logo Small

Restore-ADObject



This is the built-in help made by Microsoft for the command 'Restore-ADObject', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 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 <ADAuthType>] [-Credential <PSCredential>] [-NewName <String>] [-Partition <String>]
[-PassThru [<SwitchParameter>]] [-Server <String>] [-TargetPath <String>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]
[<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 -IncludedeDeletedObjects parameter
specified.



<

RELATED LINKS

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

REMARKS

<

Examples


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

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



Description

-----------

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 --------------------------

C:\PS>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"



Description

-----------

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 --------------------------

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



Description

-----------

Find a deleted user whose samaccountname is kimabercrombie, and restore it.




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

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



Description

-----------

Restore an AD-LDS object using ObjectGUID.




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

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



Description

-----------

Restore an AD-LDS object using msds-LastKnownRDN.