Solved

Need script to perform ipconfig /dnsflush & dnsregister commands on multiple servers.

Posted on 2014-04-10
3
898 Views
Last Modified: 2014-04-24
We have added DNS entries in multiple servers however we didn't perform dns flush.

We need script through which we can perform ipconfig /dnsflush  & ipconfig /dnsregister commands on multiple servers at once.
0
Comment
Question by:biplabmukh
  • 2
3 Comments
 
LVL 29

Accepted Solution

by:
becraig earned 500 total points
ID: 39992275
If you have winrm running and PS in your envrionment:
gc serverlist.txt | % {
invoke-command -computername $_ -scriptblock {
ipconfig /flushdns
ipconfig /registerdns
}
}

Open in new window


if you do not and you have psexec:
 for /f %a in (serverlist.txt) do psexec \\%a cmd /c ipconfig /flushdns & ipconfig /registerdns
0
 
LVL 29

Assisted Solution

by:becraig
becraig earned 500 total points
ID: 40013737
Did either of the above commands work for you ?

If you have issues running psexec, it could be permissions issues and you need to add username and password:
e.g.

 for /f %a in (serverlist.txt) do psexec -u domain\user -p password \\%a cmd /c ipconfig /flushdns & ipconfig /registerdns
0
 

Author Closing Comment

by:biplabmukh
ID: 40019529
Above commands helped me partially.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need recommendation for a DNS host provider. 3 91
Windows Server 2012 Data Center Edition 11 120
ost file to pst 10 167
Cookies and new tab 3 54
This article covers how to install the Microsoft Windows Operating System (OS). What is covered in this article:  > Different Versions and Editions of the Windows OS  > Upgrading versus Fresh Installation of the OS           - Steps to take pr…
Log files are useful in diagnosing and repairing problems.  This is a list of common log files and their standard locations that I've compiled.   While this is not exhaustive, it is a pretty good list that I've found to be useful.  I may update it f…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question