I am trying to restore object and can find it but it wont restore! If i search by name or display name i get similar error in first place but with samaccountname i can locate it but cant restore. I tried LDAP method and got error there too of different kind.
PS C:\Users\administrator.domain> Get-ADObject -Filter {samaccountname -eq
"XenTmplt$"} -IncludeDeletedObjects
Deleted : True
DistinguishedName : CN=XENTMPLT\0ADEL:e51eef47-02ba-40c7-acb9-fea3f9a0af7b,CN=D
eleted Objects,DC=domain,DC=local
Name : XENTMPLT
DEL:e51eef47-02ba-40c7-acb9-fea3f9a0af7b
ObjectClass : computer
ObjectGUID : e51eef47-02ba-40c7-acb9-fea3f9a0af7b
PS C:\Users\administrator.domain> Get-ADObject -Filter {samaccountname -eq
"XenTmplt$"} -IncludeDeletedObjects | Restore-ADObject
Restore-ADObject : Illegal modify operation. Some aspect of the modification is
not permitted
At line:1 char:96
+ Get-ADObject -Filter {samaccountname -eq "XenTmplt$"} -IncludeDeletedObjects
| Restore-ADObject <<<<
+ CategoryInfo : InvalidOperation: (CN=XENTMPLT\0AD...lacorp,DC=l
ocal:ADObject) [Restore-ADObject], ADIllegalModifyOperationException
+ FullyQualifiedErrorId : 0,Microsoft.ActiveDirectory.Management.Commands.
RestoreADObject