Home > Active Directory > Don’t use this script in a large domain…

Don’t use this script in a large domain…

Sometimes, before trying to troubleshoot, you might want to restart all of the major components of AD. Copy this into a small CMD and run (requires psexec):

for /F %%i in (‘dsquery server -forest -o rdn’) do psexec \\%%~i ipconfig /flushdns
for /F %%i in (‘dsquery server -forest -o rdn’) do psexec \\%%~i nbtstat -R
for /F %%i in (‘dsquery server -forest -o rdn’) do psexec \\%%~i nbtstat -RR
for /F %%i in (‘dsquery server -forest -o rdn’) do psexec \\%%~i ipconfig /registerdns
for /F %%i in (‘dsquery server -forest -o rdn’) do psexec \\%%~i netdiag /fix
for /F %%i in (‘dsquery server -forest -o rdn’) do psexec \\%%~i dcdiag /fix
for /F %%i in (‘dsquery server -forest -o rdn’) do psexec \\%%~i net stop netlogon & net start netlogon
for /F %%i in (‘dsquery server -forest -o rdn’) do psexec \\%%~i net stop dhcp & net start Dhcp
for /F %%i in (‘dsquery server -forest -o rdn’) do psexec \\%%~i net stop dns & net start dns
for /F %%i in (‘dsquery server -forest -o rdn’) do psexec \\%%~i repadmin /syncall

Categories: Active Directory Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Say something!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: