Domain Controller Health Check
As an IT Admin, it is very crucial task to keep the Domain Controllers up and running and periodically check for domain controller health issues. Open an elevated PowerShell command prompt and run the following command to check domain controller health
dcdiag | Select-String -pattern "failed test" | Select-String -pattern "NCSecDesc","KccEvent" -NotMatch #Address any errors. Get-WinEvent -LogName "Directory Service" | Where-Object { $_.id -eq 1394 } | Select-Object -First 1 #Should be present at boot time unless logs have turned over. Get-WinEvent -LogName "DNS Server" -MaxEvents 1000 | Where-Object { $_.id -eq 4 } | Select-Object -First 1 #Should be present at boot time unless logs have turned over. Get-WinEvent -LogName "File Replication Service" -MaxEvents 1000 | Where-Object { $_.id -eq 13516 } | Select-Object -First 1 #Should be present at boot time unless logs have turned over. Get-WinEvent -MaxEvents 1000 -FilterHashtable @{logname='security'; id=4624; starttime=(get-date).date } | where-object {$_.properties[8].value -eq 3} | Select-Object -First 1 #Indicates network logon. Get-WinEvent -LogName "System" | Where-Object { $_.id -eq 6008 } | Select-Object -First 1 #Indicates the last time the server shutdown unexpectedly gpupdate /force #Checks that group policies are being applied nslookup www.google.com $env:computername #Checks that local DNS server can resolve googles address nslookup $env:computername $env:computername #Checks that local DNS server can resolve its own name REPADMIN /SHOWREPS #Replication health checks