• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 12252
  • Last Modified:

Can we flushdns & Registerdns on all machines in the network remotely

Hi,

Can we flushdns & Registerdns on all machines in the network.Remotely.

Regards
Sharath
1
bsharath
Asked:
bsharath
  • 2
  • 2
2 Solutions
 
canaliCommented:
You need psexec (http://www.microsoft.com/technet/sysinternals/utilities/psexec.mspx)
@Echo Off
:: flushdns and Registerdns
setlocal
FOR /F %%c IN (C:\computers.txt) Do (
      Echo Flush and register DNS on %%c
      c:\temp\psexec \\%%c  -i -d -s c:\windows\system32\ipconfig /flushdns
      c:\temp\psexec \\%%c  -i -d -s c:\windows\system32\ipconfig /Registerdns
)

0
 
bsharathAuthor Commented:
I get this

Flush and register DNS on dev-chen-srv10
The system cannot find the path specified.
The system cannot find the path specified.
Flush and register DNS on indiasophos
The system cannot find the path specified.
The system cannot find the path specified.
Press any key to continue . . .
0
 
canaliCommented:

@Echo Off
:: flushdns and Registerdns ok
setlocal
FOR /F %%c IN (C:\computers.txt) Do (
      Echo Flush and register DNS on %%c
      c:\temp\psexec \\%%c  -i -d -s c:\windows\system32\ipconfig.exe /flushdns
      c:\temp\psexec \\%%c  -i -d -s c:\windows\system32\ipconfig.exe /Registerdns
)
0
 
bsharathAuthor Commented:
Hi,

Should psexec be in the remote machine ?
c:\temp\psexec
0
 
Farhan KaziSystems EngineerCommented:
To run canal's script make 'temp' folder on C: drive root and copy 'PSExec.exe' into that folder and run your batch.

OR modify the path where PSExec.exe resides.
Like for following code, PSExec should be on the path from where you are running this batch (not necessarily on remote system)

@Echo Off
:: flushdns and Registerdns ok
setlocal
FOR /F %%c IN (C:\computers.txt) Do (
      Echo Flush and register DNS on %%c
      psexec \\%%c  -i -d -s c:\windows\system32\ipconfig.exe /flushdns
      psexec \\%%c  -i -d -s c:\windows\system32\ipconfig.exe /Registerdns
)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now