Estou trabalhando em uma estação de trabalho do Windows 7, com o PowerShell v2.0, e tentando excluir um objeto específico (órfão?) do contêiner LostAndFound
em uma floresta e domínio de 2008 R2 FL com o Lixeira do Active Directory ativada e não tendo sorte com qualquer coisa .
Importante, eu preciso excluir este objeto, e apenas este objeto (em vez de excluir todos os objetos com a propriedade IsDeleted
, que parece ser tudo que posso encontrar ajuda em).
Eu preciso excluir, porque para resolver uma relação de confiança quebrada, o computador foi desconectado do domínio (presumivelmente fazendo com que o objeto fosse para a Lixeira e depois para o contêiner LostAndFound
) e nós gostaria de dar seu nome original de volta (que é baseado no número da etiqueta de patrimônio no PC). Tentativas de ingressar novamente no computador com o nome correto falhou com a mensagem de erro abaixo ( The specified account does not exist
)
etentarrenomeá-loparaonomecorreto,umavezqueelejáestánodomínio,falhacomamensagemdeerroabaixo(Theaccountalreadyexists
)
para que o PC atual esteja com um nome incorreto, que preciso corrigir.
No entanto, a tentativa de excluir esse objeto do AD gera o erro: The specified account does not exist
. O nome distinto do objeto tem um caractere \
(barra invertida), que eu suponho ser devido ao fato de ele estar no contêiner LostAndFound
, e eu estou querendo saber se esse é o problema ... e como corrigi-lo . Estou executando meu shell como domain admin
, verifiquei que domain admins
group tem controle total e propriedade do objeto em questão, e simplesmente não consigo descobrir isso.
O objeto em questão (um pouco redigido):
Get-ADObject "CN=SomeComputerGet-ADObject "CN=SomeComputerGet-ADObject "90a13eaa-c7b0-4258-bebb-87b7aed39ec6" -IncludeDeletdObjects | Remove-ADObject
Confirm
Are you sure you want to perform this action?
Performing operation "Remove" on Target
"CN=SomeComputer$blah = "90a13eaa-c7b0-4258-bebb-87b7aed39ec6"
Get-ADObject $blah -IncludeDeletedObjects | Remove-ADObject
Confirm
Are you sure you want to perform this action?
Performing operation "Remove" on Target
"CN=SomeComputerdsrm "CN=SomeComputerGet-ADObject "CN=SomeComputer'0ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -IncludeDeletedObjects | Remove-ADObject
Get-ADObject : No superior reference has been configured for the directory service. The directory service is therefore unable to issue referrals to objects outside this forest
At line:1 char:13
+ Get-ADObject <<<< "CN=SomeComputer'0ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -Includ
eDeletedObjects | Remove-ADObject
+ CategoryInfo : NotSpecified: (CN=SomeComputer ADEL...MyEmployer,DC=prv:ADObject) [Get-ADObject], ADException
+ FullyQualifiedErrorId : No superior reference has been configured for the directory service. The directory service is therefore unable to issue referrals to objects outside this forest,Microsoft.ActiveDirectory.Management.Commands.GetADObject
ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=Lost
AndFound,DC=MyEmployer,DC=prv"
Are you sure you wish to delete CN=SomeComputerGet-ADObject "SomeComputer'n'rDEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -IncludeDeletedObjects | Remove-ADObject
Get-ADObject : The object name has bad syntax
At line:1 char:13
+ Get-ADObject <<<< "CN=SomeComputer'n'rDEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -IncludeDeletedObjects | Remove-ADObject
+ CategoryInfo : NotSpecified: (CN=SomeComputer
DEL...MyEmployer,DC=prv:ADObject) [Get-ADObject], ADException
+ FullyQualifiedErrorId : The object name has bad syntax,Microsoft.ActiveDirectory.Management.Commands.GetADObject
ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv
(Y/N)? y
dsrm failed:CN=SomeComputerGet-ADObject "CN=SomeComputer'fDEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -IncludeDeletedObjects | Remove-ADObject
Get-ADObject : Directory object not found
At line:1 char:13
+ Get-ADObject <<<< "CN=SomeComputer'fDEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -IncludeDeletedObjects | Remove-ADObject
+ CategoryInfo : ObjectNotFound: (CN=SomeComputer♀DEL:...MyEmployer,DC=prv:ADObject) [Get-ADObject], ADIdentityNotFoundException
+ FullyQualifiedErrorId : Directory object not found,Microsoft.ActiveDirectory.Management.Commands.GetADObject
ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv:The specified account does not exist.
ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Remove-ADObject : The specified account does not exist
At line:1 char:60
+ Get-ADObject $blah -IncludeDeletedObjects | Remove-ADObject <<<<
+ CategoryInfo : NotSpecified: (CN=SomeComputerGet-ADObject -Filter { Name -Like '*DEL:*' } -IncludeDeletedObjects | Remove-ADObject
Confirm
Are you sure you want to perform this action?
Performing operation "Remove" on Target "CN=SomeServer-SomeJackass HP LaserJet 1320
PSGet-ADObject "CN=SomeComputerGet-ADObject "CN=SomeComputerGet-ADObject "90a13eaa-c7b0-4258-bebb-87b7aed39ec6" -IncludeDeletdObjects | Remove-ADObject
Confirm
Are you sure you want to perform this action?
Performing operation "Remove" on Target
"CN=SomeComputer$blah = "90a13eaa-c7b0-4258-bebb-87b7aed39ec6"
Get-ADObject $blah -IncludeDeletedObjects | Remove-ADObject
Confirm
Are you sure you want to perform this action?
Performing operation "Remove" on Target
"CN=SomeComputerdsrm "CN=SomeComputerGet-ADObject "CN=SomeComputer'0ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -IncludeDeletedObjects | Remove-ADObject
Get-ADObject : No superior reference has been configured for the directory service. The directory service is therefore unable to issue referrals to objects outside this forest
At line:1 char:13
+ Get-ADObject <<<< "CN=SomeComputer'0ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -Includ
eDeletedObjects | Remove-ADObject
+ CategoryInfo : NotSpecified: (CN=SomeComputer ADEL...MyEmployer,DC=prv:ADObject) [Get-ADObject], ADException
+ FullyQualifiedErrorId : No superior reference has been configured for the directory service. The directory service is therefore unable to issue referrals to objects outside this forest,Microsoft.ActiveDirectory.Management.Commands.GetADObject
ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=Lost
AndFound,DC=MyEmployer,DC=prv"
Are you sure you wish to delete CN=SomeComputerGet-ADObject "SomeComputer'n'rDEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -IncludeDeletedObjects | Remove-ADObject
Get-ADObject : The object name has bad syntax
At line:1 char:13
+ Get-ADObject <<<< "CN=SomeComputer'n'rDEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -IncludeDeletedObjects | Remove-ADObject
+ CategoryInfo : NotSpecified: (CN=SomeComputer
DEL...MyEmployer,DC=prv:ADObject) [Get-ADObject], ADException
+ FullyQualifiedErrorId : The object name has bad syntax,Microsoft.ActiveDirectory.Management.Commands.GetADObject
ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv
(Y/N)? y
dsrm failed:CN=SomeComputerGet-ADObject "CN=SomeComputer'fDEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -IncludeDeletedObjects | Remove-ADObject
Get-ADObject : Directory object not found
At line:1 char:13
+ Get-ADObject <<<< "CN=SomeComputer'fDEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -IncludeDeletedObjects | Remove-ADObject
+ CategoryInfo : ObjectNotFound: (CN=SomeComputer♀DEL:...MyEmployer,DC=prv:ADObject) [Get-ADObject], ADIdentityNotFoundException
+ FullyQualifiedErrorId : Directory object not found,Microsoft.ActiveDirectory.Management.Commands.GetADObject
ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv:The specified account does not exist.
ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Remove-ADObject : The specified account does not exist
At line:1 char:60
+ Get-ADObject $blah -IncludeDeletedObjects | Remove-ADObject <<<<
+ CategoryInfo : NotSpecified: (CN=SomeComputerGet-ADObject -Filter { Name -Like '*DEL:*' } -IncludeDeletedObjects | Remove-ADObject
Confirm
Are you sure you want to perform this action?
Performing operation "Remove" on Target "CN=SomeServer-SomeJackass HP LaserJet 1320
PS%pre%ADEL:eddb23e7-b8d8-4d00-801f-22d82c169d66,CN=Deleted Objects,DC=MyEmployer,DC=prv".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Confirm
Are you sure you want to perform this action?
Performing operation "Remove" on Target "CN=SomeServer-SomeJackass HP LaserJet 1320 PCL
5e%pre%ADEL:6e72e78f-f110-492c-ad50-91107f6fbd6a,CN=Deleted Objects,DC=MyEmployer,DC=prv".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
ADE...MyEmployer,DC=prv:ADObject) [Remove-ADObject], ADException
+ FullyQualifiedErrorId : The specified account does not exist,Microsoft.ActiveDirectory.Management.Commands.RemoveADObject
ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Remove-ADObject : The specified account does not exist
At line:1 char:94
+ Get-ADObject "90a13eaa-c7b0-4258-bebb-87b7aed39ec6" -IncludeDeletedObjects | Remove-ADObject <<<<
+ CategoryInfo : NotSpecified: (CN=SomeComputer%pre%ADE...MyEmployer,DC=prv:ADObject) [Remove-ADObject], ADException
+ FullyQualifiedErrorId : The specified account does not exist,Microsoft.ActiveDirectory.Management.Commands.RemoveADObject
ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -IncludeDeletedObjects | Remove-ADObject
Confirm
Are you sure you want to perform this action?
Performing operation "Remove" on Target
"CN=SomeComputer%pre%ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Remove-ADObject : The specified account does not exist
At line:1 char:145
+ Get-ADObject "CN=SomeComputer%pre%ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -IncludeDeletedObjects | Remove-ADObject <<<<
+ CategoryInfo : NotSpecified: (CN=SomeComputer%pre%ADE...MyEmployer,DC=prv:ADObject) [Remove-ADObject], ADException
+ FullyQualifiedErrorId : The specified account does not exist,Microsoft.ActiveDirectory.Management.Commands.RemoveADObject
ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -IncludeDeletedObjects -Properties *
accountExpires : 9223372036854775807
CanonicalName : MyEmployer.prv/LostAndFound/SomeComputer
DEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6
CN : SomeComputer
DEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6
codePage : 0
countryCode : 0
Created : 12/7/2012 9:25:30 PM
createTimeStamp : 12/7/2012 9:25:30 PM
Deleted :
Description : HP6300
DisplayName :
DistinguishedName : CN=SomeComputer%pre%ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=
prv
dNSHostName : SomeComputer.MyEmployer.prv
dSCorePropagationData : {5/21/2014 1:40:31 PM, 12/31/1600 7:00:00 PM}
instanceType : 4
isCriticalSystemObject : False
isDeleted :
LastKnownParent : OU=Workstations,OU=Computers,OU=One of Our Sites,DC=MyEmployer,DC=prv
lastLogonTimestamp : 130451668084269817
localPolicyFlags : 0
memberOf : {CN=PCMilerComputers,DC=MyEmployer,DC=prv}
Modified : 5/21/2014 1:40:54 PM
modifyTimeStamp : 5/21/2014 1:40:54 PM
msDS-LastKnownRDN : SomeComputer
Name : SomeComputer
DEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6
nTSecurityDescriptor : System.DirectoryServices.ActiveDirectorySecurity
ObjectCategory :
ObjectClass : computer
ObjectGUID : 90a13eaa-c7b0-4258-bebb-87b7aed39ec6
objectSid : S-1-5-21-1708945318-605057401-313073093-5882480
operatingSystem : Windows 7 Enterprise
operatingSystemServicePack : Service Pack 1
operatingSystemVersion : 6.1 (7601)
primaryGroupID : 515
ProtectedFromAccidentalDeletion : False
pwdLastSet : 130451667147545072
sAMAccountName : SomeComputer$
sDRightsEffective : 15
servicePrincipalName : {HOST/SomeComputer, HOST/SomeComputer.MyEmployer.prv}
userAccountControl : 4096
userCertificate : [Not included]
uSNChanged : 54007434
uSNCreated : 5004556
whenChanged : 5/21/2014 1:40:44 PM
whenCreated : 12/7/2012 9:25:30 PM
ADEL:eddb23e7-b8d8-4d00-801f-22d82c169d66,CN=Deleted Objects,DC=MyEmployer,DC=prv".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Confirm
Are you sure you want to perform this action?
Performing operation "Remove" on Target "CN=SomeServer-SomeJackass HP LaserJet 1320 PCL
5e%pre%ADEL:6e72e78f-f110-492c-ad50-91107f6fbd6a,CN=Deleted Objects,DC=MyEmployer,DC=prv".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
ADE...MyEmployer,DC=prv:ADObject) [Remove-ADObject], ADException
+ FullyQualifiedErrorId : The specified account does not exist,Microsoft.ActiveDirectory.Management.Commands.RemoveADObject
ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Remove-ADObject : The specified account does not exist
At line:1 char:94
+ Get-ADObject "90a13eaa-c7b0-4258-bebb-87b7aed39ec6" -IncludeDeletedObjects | Remove-ADObject <<<<
+ CategoryInfo : NotSpecified: (CN=SomeComputer%pre%ADE...MyEmployer,DC=prv:ADObject) [Remove-ADObject], ADException
+ FullyQualifiedErrorId : The specified account does not exist,Microsoft.ActiveDirectory.Management.Commands.RemoveADObject
ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -IncludeDeletedObjects | Remove-ADObject
Confirm
Are you sure you want to perform this action?
Performing operation "Remove" on Target
"CN=SomeComputer%pre%ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Remove-ADObject : The specified account does not exist
At line:1 char:145
+ Get-ADObject "CN=SomeComputer%pre%ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -IncludeDeletedObjects | Remove-ADObject <<<<
+ CategoryInfo : NotSpecified: (CN=SomeComputer%pre%ADE...MyEmployer,DC=prv:ADObject) [Remove-ADObject], ADException
+ FullyQualifiedErrorId : The specified account does not exist,Microsoft.ActiveDirectory.Management.Commands.RemoveADObject
ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=prv" -IncludeDeletedObjects -Properties *
accountExpires : 9223372036854775807
CanonicalName : MyEmployer.prv/LostAndFound/SomeComputer
DEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6
CN : SomeComputer
DEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6
codePage : 0
countryCode : 0
Created : 12/7/2012 9:25:30 PM
createTimeStamp : 12/7/2012 9:25:30 PM
Deleted :
Description : HP6300
DisplayName :
DistinguishedName : CN=SomeComputer%pre%ADEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6,CN=LostAndFound,DC=MyEmployer,DC=
prv
dNSHostName : SomeComputer.MyEmployer.prv
dSCorePropagationData : {5/21/2014 1:40:31 PM, 12/31/1600 7:00:00 PM}
instanceType : 4
isCriticalSystemObject : False
isDeleted :
LastKnownParent : OU=Workstations,OU=Computers,OU=One of Our Sites,DC=MyEmployer,DC=prv
lastLogonTimestamp : 130451668084269817
localPolicyFlags : 0
memberOf : {CN=PCMilerComputers,DC=MyEmployer,DC=prv}
Modified : 5/21/2014 1:40:54 PM
modifyTimeStamp : 5/21/2014 1:40:54 PM
msDS-LastKnownRDN : SomeComputer
Name : SomeComputer
DEL:90a13eaa-c7b0-4258-bebb-87b7aed39ec6
nTSecurityDescriptor : System.DirectoryServices.ActiveDirectorySecurity
ObjectCategory :
ObjectClass : computer
ObjectGUID : 90a13eaa-c7b0-4258-bebb-87b7aed39ec6
objectSid : S-1-5-21-1708945318-605057401-313073093-5882480
operatingSystem : Windows 7 Enterprise
operatingSystemServicePack : Service Pack 1
operatingSystemVersion : 6.1 (7601)
primaryGroupID : 515
ProtectedFromAccidentalDeletion : False
pwdLastSet : 130451667147545072
sAMAccountName : SomeComputer$
sDRightsEffective : 15
servicePrincipalName : {HOST/SomeComputer, HOST/SomeComputer.MyEmployer.prv}
userAccountControl : 4096
userCertificate : [Not included]
uSNChanged : 54007434
uSNCreated : 5004556
whenChanged : 5/21/2014 1:40:44 PM
whenCreated : 12/7/2012 9:25:30 PM
Nada do que tentei parece funcionar e já tentei bastante. Na mesma nota, o que eu tentei abaixo.
Primeiro, com um cmdlet simples do PowerShell de uma linha:
%pre%
Então, a mesma coisa, referenciando o GUID.
%pre%
Em seguida, leia o valor em uma variável primeiro. (Tentei com ambos GUID e DN, mostrando apenas um, pois eles produzem o mesmo erro).
%pre%
Então, achei que poderia conviver com como ter que chamar o DSRM em vez de fazê-lo originalmente.
%pre%
Então eu disse para o inferno em torná-lo automatizável, vou apenas clicar com o botão direito e apague-o através do ADSIedit .
Então, finalmente, estou engolindo meu orgulho e perguntando aqui. Como diabos eu me livre desse maldito objeto? Ele claramente existe, e sua existência está causando problemas, mas todas as minhas tentativas de apagá-lo do Active Directory são encontradas com mentiras, mentiras e mensagens de erro .
Atualização:
Outras coisas que não funcionaram, com base em comentários, sugestões e discussões com o ServerFaulters:
Escapando o 0
, como se o %code%A
A
A
A
representasse um byte nulo.
%pre%
Escapando todo o %code% , como se fosse um retorno de carro ou uma nova linha, como no DOS (tentei com 'n,' r, 'n'r e' r'n). Todos retornaram o mesmo erro, portanto, apenas mostrado uma vez.
%pre%
Escapando o %code% como um feed de formulário (sim, ficando um pouco desesperado).
%pre%
Então achei que deveria determinar se o caractere %code% era o problema, então escolhi um objeto diferente que não me importava na Lixeira do AD com a string %code% e tentei explodi-lo longe. Funcionou.
%pre%