1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114 | $dc = 'DC01', 'DC02', 'DC03'
$dc | ForEach-Object -Process {
write-host $_ -ForegroundColor Yellow
nltest.exe /QUERY
}
## Force out of schedule replication
$dc | ForEach-Object -Process {
write-host $_ -ForegroundColor Yellow
repadmin /syncall /force /APed
}
## Update DFSR state
$dc | ForEach-Object -Process {
Update-DfsrConfigurationFromAD -ComputerName $_ -Verbose
}
$dc | ForEach-Object -Process {
write-host $_ -ForegroundColor Yellow
repadmin /replsum
}
$dc | ForEach-Object -Process {
write-host $_ -ForegroundColor Yellow
dcdiag /e /c /q
}
$dc | ForEach-Object -Process {
write-host $_ -ForegroundColor Yellow
dcdiag /e /test:sysvolcheck /test:advertising
}
$dc | ForEach-Object -Process {
write-host $_ -ForegroundColor Yellow
Invoke-Command -ComputerName $_ -ScriptBlock {
nltest.exe /DCLIST:domain.local
}
}
$dc | ForEach-Object -Process {
write-host $_ -ForegroundColor Yellow
Invoke-Command -ComputerName $_ -ScriptBlock {
nltest.exe /DSREGDNS
}
}
$dc | ForEach-Object -Process {
Invoke-Command -ComputerName $_ -ScriptBlock {
nltest.exe /DSQUERYDNS
}
}
$dc | ForEach-Object -Process {
write-host $_ -ForegroundColor Yellow
Invoke-Command -ComputerName $_ -ScriptBlock {
repadmin /syncall
}
}
$dc | ForEach-Object -Process {
write-host $_ -ForegroundColor Yellow
Invoke-Command -ComputerName $_ -ScriptBlock {
repadmin /showrepl
}
}
Clear-Host
$dc | ForEach-Object -Process {
write-host $_ -ForegroundColor Yellow
Invoke-Command -ComputerName $_ -ScriptBlock {
dcdiag /fix
}
}
Clear-Host
$dc | ForEach-Object -Process {
write-host $_ -ForegroundColor Yellow
Invoke-Command -ComputerName $_ -ScriptBlock {
wevtutil el | Foreach-Object {wevtutil cl "$_"}
}
}
### Enable Strict Replication Consistency
$dc | ForEach-Object -Process {
Invoke-Command -ComputerName $_ -ScriptBlock {
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters' -Name 'Strict Replication Consistency' -Value '1' -PropertyType DWORD -Force
}
}
### Disable Strict Replication Consistency
$dc | ForEach-Object -Process {
Invoke-Command -ComputerName $_ -ScriptBlock {
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters' -Name 'Strict Replication Consistency' -Value '0' -PropertyType DWORD -Force
}
}
### Enable inbound replication on the domain controller when lingering objects exist
$dc | ForEach-Object -Process {
Invoke-Command -ComputerName $_ -ScriptBlock {
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters' -Name 'Allow Replication With Divergent and Corrupt Partner' -Value '1' -PropertyType DWORD -Force
}
}
### Disable inbound replication on the domain controller when lingering objects exist
$dc | ForEach-Object -Process {
Invoke-Command -ComputerName $_ -ScriptBlock {
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters' -Name 'Allow Replication With Divergent and Corrupt Partner' -Value '0' -PropertyType DWORD -Force
}
}
### Search by Event ID
$dc | ForEach-Object -Process {
Invoke-Command -ComputerName $_ -ScriptBlock {
Get-EventLog -logname 'Directory Service' | ?{ ($_.eventid -eq "1388") -or ($_.eventid -eq "1988") -or ($_.eventid -eq "2042") }
}
}
|