Páginas

Erro replicação AD "The target principal name is incorrect"

 É comum após um servidor replica de AD ficar algumas semanas sem comunicação que o mesmo perca a replicação e retorne a mensagem:

Naming information cannot be located because:

The target principal name is incorrect


Para resolver esse problema faça o seguinte:


No servidor que está com falha na replicação, acesse services.msc e procure pelo serviço Kerberos Key Distribution Center


Em seguida DESATIVE esse serviço, então reinicie o servidor.

Após ligar novamente o servidor, teste se a replicação está OK. Se estiver ative o serviço novamente.






Como adicionar um atributo ao Schema do AD

Passo a passo para adicionar um novo atributo ao Schema do Active Directory.

1- Acesse o servidor Active Directory que roda a FSMO Schema Master, é necessário instalar a dll engine Schema com o comando:

regsvr32 schmmgmt.dll




2- Clique em OK




3- Depois abra o executar e digite MMC


4- Na console MCC selecione a opção Attribute e depois Create Attribute.




5- Para a criação de um novo atributo é necessário saber o OID está sendo utilizado pelo ambiente.
Para isso copie o código vbs abaixo no notepad e salve no desktop como rootOID.vbs, depois execute o mesmo.

' oidgen.vbs
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
' OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR
' FITNESS FOR A PARTICULAR PURPOSE.'
' Copyright (c) Microsoft Corporation. All rights reserved'
' This script is not supported under any Microsoft standard support program or service.
' The script is provided AS IS without warranty of any kind. Microsoft further disclaims all
' implied warranties including, without limitation, any implied warranties of merchantability
' or of fitness for a particular purpose. The entire risk arising out of the use or performance
' of the scripts and documentation remains with you. In no event shall Microsoft, its authors,
' or anyone else involved in the creation, production, or delivery of the script be liable for
' any damages whatsoever (including, without limitation, damages for loss of business profits,
' business interruption, loss of business information, or other pecuniary loss) arising out of
' the use of or inability to use the script or documentation, even if Microsoft has been advised
' of the possibility of such damages.
' ----------------------------------------------------------------------Function GenerateOID()
'Initializing VariablesDim guidString, oidPrefix
Dim guidPart0, guidPart1, guidPart2, guidPart3, guidPart4, guidPart5, guidPart6
Dim oidPart0, oidPart1, oidPart2, oidPart3, oidPart4, oidPart5, oidPart6
On Error Resume Next'Generate GUID
Set TypeLib = CreateObject("Scriptlet.TypeLib")
guidString = TypeLib.Guid'If no network card is available on the machine then generating GUID can result with an error.
If Err.Number <> 0 Then
Wscript.Echo "ERROR: Guid could not be generated, please ensure machine has a network card."
Err.Clear
WScript.Quit
End If
'Stop Error Resume Next
On Error GoTo 0'The Microsoft OID Prefix used for the automated OID Generator
oidPrefix = "1.2.840.113556.1.8000.2554"'Split GUID into 6 hexadecimal numbers
guidPart0 = Trim(Mid(guidString, 2, 4))
guidPart1 = Trim(Mid(guidString, 6, 4))
guidPart2 = Trim(Mid(guidString, 11, 4))
guidPart3 = Trim(Mid(guidString, 16, 4))
guidPart4 = Trim(Mid(guidString, 21, 4))
guidPart5 = Trim(Mid(guidString, 26, 6))
guidPart6 = Trim(Mid(guidString, 32, 6))'Convert the hexadecimal to decimal
oidPart0 = CLng("&H" & guidPart0)
oidPart1 = CLng("&H" & guidPart1)
oidPart2 = CLng("&H" & guidPart2)
oidPart3 = CLng("&H" & guidPart3)
oidPart4 = CLng("&H" & guidPart4)
oidPart5 = CLng("&H" & guidPart5)
oidPart6 = CLng("&H" & guidPart6)'Concatenate all the generated OIDs together with the assigned Microsoft prefix and return
GenerateOID = oidPrefix & "." & oidPart0 & "." & oidPart1 & "." & oidPart2 & "." & oidPart3 & _
"." & oidPart4 & "." & oidPart5 & "." & oidPart6
'Output the resulted OID with best practice infoWscript & _
Wscript.Echo "Your root OID is: " & VBCRLF & GenerateOID & VBCRLF & VBCRLF & VBCRLF




6- Copie esse OID


7- Com o OID em mãos, coloque os dados do atributo que deseja e mais o OID, no final desse OID insira .1 (se for criar outros coloque .2, .3... e assim por diante)




8- Clique OK para finalizar


9- Depois selecione Classes no MMC e navegue até User e com o botão direito selecione a opção Properties




10 - Localize o atributo que você criou e clique em OK




11- Vá em services.msc e reinicie o serviço Active Directory Domain Services


12 - Por fim abra Users and Computers, vá até View e depois selecione a opção Advanced Features




13- Navegue até OU Users, selecione um usuário qualquer e com o botão direito selecione a opção Properties. Navegue até a guia Attribute Editor e confirme que o valor é apresentado.




Take Ownership pastas com Acesso Negado


Se você não consegue excluir/alterar alguma pasta recebendo o erro: "Acesso Negado"

Faça o seguinte:

takeown /F "Full Path of Folder or File"

Após o primeiro comando, já tente excluir/renomear a pasta, caso não funcine execute os comandos abaixo.

takeown /F "Full Path of Folder or File" /r /d y
icacls "Full Path of Folder or File" /grant Administrators:F
icacls "Full Path of Folder or File" /grant Administrators:F /t

DESATIVAR Windows Update no Windows 10 e Server 2016


Abra o CMD e digite sconfig e clique em “Enter”

Digite 5 e clique em Enter

Digite M e clique em Enter

Será exibido um alerta de confirmação


Desative também o serviço do Windows Update

Entre nos serviços do windows clique duas vezes em Windows Update

No campo Startup Type altere para Disabled

Clique em Stop

Clique em OK




w32time usando Local CMOS Clock

Em máquinas virtuais é comum você alterar o servidor NTP (via regedit) e após fazer a consulta do Source do w32time com o comando:

w32tm /query /source

Receber o retorno: Local CMOS Clock


Para resolver isso faça o seguinte... Vá até a máquina virtual no Hyper-V, clique com o botão direito e vá em Settings


Após clique em Integration Services e desmarque Time synchronization


Feito isso digite os seguintes comandos:

net stop w32time
w32tm /unregister
w32tm /register 
net start w32time

Pronto!