Thursday 21 November 2013

Active Directory Health Check script

This handy script can be used to check the health of your active directory.

@echo off
del c:\ADHealth.txt

echo ________________________________ >> c:\ADHealth.txt
echo Domain Controllers In the Domain >> c:\ADHealth.txt
echo ________________________________ >> c:\ADHealth.txt
C:\Windows\System32\DSQUERY Server -o rdn >> c:\ADHealth.txt
echo _________________ >> c:\ADHealth.txt
echo FSMO role holders >> c:\ADHealth.txt
echo _________________ >> c:\ADHealth.txt
C:\Windows\System32\netdom query fsmo >> c:\ADHealth.txt
echo ______________________ >> c:\ADHealth.txt
echo Repadmin - Syncall - e >> c:\ADHealth.txt
echo ______________________ >> c:\ADHealth.txt
C:\Windows\System32\repadmin.exe /syncall /e >> c:\ADHealth.txt
echo ______________________ >> c:\ADHealth.txt
echo Repadmin - Syncall - a >> c:\ADHealth.txt
echo ______________________ >> c:\ADHealth.txt
C:\Windows\System32\repadmin.exe /syncall /A >> c:\ADHealth.txt
echo ______________________ >> c:\ADHealth.txt
echo Repadmin - Syncall - d >> c:\ADHealth.txt
echo ______________________ >> c:\ADHealth.txt
C:\Windows\System32\repadmin.exe /syncall /d >> c:\ADHealth.txt
echo ______________________ >> c:\ADHealth.txt
echo Repadmin - Replsummary >> c:\ADHealth.txt
echo ______________________ >> c:\ADHealth.txt
C:\Windows\System32\repadmin.exe /replsummary * >> c:\ADHealth.txt
echo ______________ >> c:\ADHealth.txt
echo Repadmin - KCC >> c:\ADHealth.txt
echo ______________ >> c:\ADHealth.txt
C:\Windows\System32\repadmin.exe /kcc * >> c:\ADHealth.txt
echo _____________________ >> c:\ADHealth.txt
echo Repadmin - showbackup >> c:\ADHealth.txt
echo _____________________ >> c:\ADHealth.txt
C:\Windows\System32\repadmin.exe /showbackup * >> c:\ADHealth.txt
echo ___________________ >> c:\ADHealth.txt
echo Repadmin - Showrepl >> c:\ADHealth.txt
echo ___________________ >> c:\ADHealth.txt
C:\Windows\System32\repadmin.exe /showrepl *  >> c:\ADHealth.txt
echo ________________ >> c:\ADHealth.txt
echo Repadmin - Queue >> c:\ADHealth.txt
echo ________________ >> c:\ADHealth.txt
C:\Windows\System32\repadmin.exe /queue *  >> c:\ADHealth.txt
echo ______________________ >> c:\ADHealth.txt
echo Repadmin - Bridgeheads >> c:\ADHealth.txt
echo ______________________ >> c:\ADHealth.txt
C:\Windows\System32\repadmin.exe /bridgeheads * /verbose >> c:\ADHealth.txt
echo _______________ >> c:\ADHealth.txt
echo Repadmin - ISTG >> c:\ADHealth.txt
echo _______________ >> c:\ADHealth.txt
C:\Windows\System32\repadmin.exe /istg * /verbose >> c:\ADHealth.txt
echo _______________________ >> c:\ADHealth.txt
echo Repadmin - Showoutcalls >> c:\ADHealth.txt
echo _______________________ >> c:\ADHealth.txt
C:\Windows\System32\repadmin.exe /showoutcalls * >> c:\ADHealth.txt
echo ____________________ >> c:\ADHealth.txt
echo Repadmin - Failcache >> c:\ADHealth.txt
echo ____________________ >> c:\ADHealth.txt
C:\Windows\System32\repadmin.exe /failcache * >> c:\ADHealth.txt
echo ____________________ >> c:\ADHealth.txt
echo Repadmin - Showtrust >> c:\ADHealth.txt
echo ____________________ >> c:\ADHealth.txt
C:\Windows\System32\repadmin.exe /showtrust * >> c:\ADHealth.txt
echo _______________ >> c:\ADHealth.txt
echo Repadmin - Bind >> c:\ADHealth.txt
echo _______________ >> c:\ADHealth.txt
C:\Windows\System32\repadmin.exe /bind * >> c:\ADHealth.txt
echo ______ >> c:\ADHealth.txt
echo Dcdiag >> c:\ADHealth.txt
echo ______ >> c:\ADHealth.txt
C:\Windows\System32\dcdiag /c /e /v >> c:\ADHealth.txt
start c:\ADHealth.txt

2 comments: