Friday, 6 February 2015

Active Directory Health Check V01

Copy the below scripts and save it to bat, the log will provide you the details description of Active

Directory.

@Echo Off

REM Set the log file path

set logfile=C:\DChealth\ADHealth.txt

REM echo on and create adhealth log file in your desktop

echo. >> %logfile%
echo. >> %logfile%

echo ======================= >> %logfile%

echo Ping result              >> %logfile%

echo ======================= >> %logfile%

for /f %%a in ('dsquery server -o rdn') do ping -n 1 %%a >nul && (echo %%a ok) >> %logfile% || (echo %%a failed to respond) >> %logfile%

echo ======================= >> %logfile%

echo Repadmin -Replsummary   >> %logfile%

echo ======================= >> %logfile%

C:\Windows\System32\Repadmin.exe /replsummary * >> %logfile%



echo ================================ >> %logfile%

echo         FSMO ROle      >> %logfile%

echo =============================== >> %logfile%

netdom query fsmo >> %logfile%


echo ================================ >> %logfile%

echo Domain Controllers In the Domain >> %logfile%

echo ================================ >> %logfile%
 
C:\windows\system32\dsquery server -o rdn >> %logfile%


echo ======================== >> %logfile%

echo Repadmin - showbacup     >> %logfile%

echo ======================== >> %logfile%

c:\windows\system32\repadmin.exe /showbackup * >> %logfile%


echo ========================= >> %logfile%

echo Repadmin - showrepl       >> %logfile%

echo ========================= >> %logfile%

c:\windows\system32\repadmin.exe /showrepl * >> %logfile%


echo ========================= >> %logfile%

echo Repadmin -Queue           >> %logfile%

echo ========================= >> %logfile%

c:\windows\system32\repadmin.exe /queue * >> %logfile%


echo ========================== >> %logfile%

echo Repadmin -Bridgeheads      >> %logfile%

echo ========================== >> %logfile%

c:\windows\system32\repadmin.exe /bridgeheads * /Verbose >> %logfile%


echo =============== >> %logfile%

echo Repadmin -ISTG  >> %logfile%

echo =============== >> %logfile%

c:\windows\system32\repadmin.exe /istg * /Verbose >> %logfile%



echo ====================== >> %logfile%

echo Repadmin -showtrust    >> %logfile%

echo ====================== >> %logfile%

c:\Windows\system32\repadmin.exe /showtrust * >> %logfile%


echo ======================= >> %logfile%

echo Repadmin -Bind          >> %logfile%

echo ======================= >> %logfile%

c:\windows\system32\repadmin.exe /bind * >> %logfile%


echo ======================= >> %logfile%

echo DCDIAG                  >> %logfile%

echo ======================= >> %logfile%

c:\windows\system32\dcdiag /c /e /v >> %logfile%

Pasue





No comments:

Post a Comment