- Windows 2003 domain (maybe applies to 2008 too)
- multiple remote sites with domain controller and replication from/to them
- restored DC has no connection to any other domain controller
- DNS is integrated in Active Directory
- sub domain on remote DC (not sure if that is relevant or not)
Symptoms:
- restored DC boots up with a bunch of errors that it cannot contact other DCs
- DNS is not available (cannot contact server)
- Active directory is accessible and authentication works
Issue:
DC wants to replicate to other DC after boot and tries that for a while and doesn’t active DNS until replication times out which could take an hour.
I worked on this issue with Veeam support and Cody from support found a registry key that disables the initial replication. With that key set DNS is available right after booting the DC. This is helpful for test environments and SureBackup jobs which require a working DC with DNS.
This is the key that needs to be set:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NTDS\Parameters
Value name: Repl Perform Initial Synchronizations
Value type: REG_DWORD
Value data: 0
The implementation to have that key set automatically was tricky and took me a few days to figure out. I wrote a vbs script that checks during system start (windows task scheduler run with a user that has permissions to reboot server and set registry key) of the domain controller if that other local domain controller is available (via ping) and also if all three vhosts are pingable (where the DC could be on), if all the devices are not reachable the registry key is set and the domain controller reboots around 7 minutes later.
You save this as vbs file in a folder of your domain controller and modify the four IP addresses with the ones you want to check for availability:
Code: Select all
strComputer = "."
Const HKEY_LOCAL_MACHINE = &H80000002
Set objRegistry = GetObject("winmgmts:\\" & _
strComputer & "\root\default:StdRegProv")
dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
strKeyPath = "SYSTEM\CurrentControlSet\Services\NTDS\Parameters"
strValueName = "Repl Perform Initial Synchronizations"
objRegistry.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
strValueb = 0
If IsNull(strValue) Then
'The registry key does not exist
strTarget = "172.x.x.11" 'other local DC
strTargetb = "172.x.x.1" 'vhost1
strTargetc = "172.x.x.2" 'vhost2
strTargetd = "172.x.x.3" 'vhost3
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colPings = objWMIService.ExecQuery _
("Select * From Win32_PingStatus where Address = '" & strTarget & "'")
If Err = 0 Then
Err.Clear
For Each objPing in colPings
If Err = 0 Then
Err.Clear
If objPing.StatusCode = 0 Then
'response from 1st
Else
Set colPingsb = objWMIService.ExecQuery _
("Select * From Win32_PingStatus where Address = '" & strTargetb & "'")
If Err = 0 Then
Err.Clear
For Each objPingb in colPingsb
If Err = 0 Then
Err.Clear
If objPingb.StatusCode = 0 Then
'no response 1st but response2
Else
Set colPingsc = objWMIService.ExecQuery _
("Select * From Win32_PingStatus where Address = '" & strTargetc & "'")
If Err = 0 Then
Err.Clear
For Each objPingc in colPingsc
If Err = 0 Then
Err.Clear
If objPingc.StatusCode = 0 Then
'no response 1st and 2nd but response3
Else
Set colPingsd = objWMIService.ExecQuery _
("Select * From Win32_PingStatus where Address = '" & strTargetd & "'")
If Err = 0 Then
Err.Clear
For Each objPingd in colPingsd
If Err = 0 Then
Err.Clear
If objPingd.StatusCode = 0 Then
'no response 1st and 2nd and 3rd but response4
Else
'no response 1st and 2nd and 3rd and 4th
objRegistry.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValueb
If Not filesys.FileExists("C:\Documents and Settings\All Users\Desktop\REPL DISABLED.txt") Then
filesys.CopyFile "C:\WINDOWS\REPL DISABLED.txt", "C:\Documents and Settings\All Users\Desktop\"
End If
WScript.Sleep 450000
objShell.Run "C:\WINDOWS\system32\shutdown.exe -r -t 0"
End If
Else
Err.Clear
'Unable to call Win32_PingStatus
End If
Next
Else
Err.Clear
'Unable to call Win32_PingStatus
End If
End If
Else
Err.Clear
'Unable to call Win32_PingStatus
End If
Next
Else
Err.Clear
'Unable to call Win32_PingStatus
End If
End If
Else
Err.Clear
'Unable to call Win32_PingStatus
End If
Next
Else
Err.Clear
'Unable to call Win32_PingStatus
End If
End If
Else
Err.Clear
'Unable to call Win32_PingStatus
End If
Next
Else
Err.Clear
'Unable to call Win32_PingStatus
End If
Else
' the regkey exists
End If
Code: Select all
Replication is disabled to speedup Domain/DNS startup when other domain controllers and sites are not available.
To activate Replication remove this entry in the regsitry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NTDS\Parameters\Repl Perform Initial Synchronizations
and reboot!