Solved

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

Posted on 2014-04-10
3
876 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 28

Accepted Solution

by:
becraig earned 500 total points
Comment Utility
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 28

Assisted Solution

by:becraig
becraig earned 500 total points
Comment Utility
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
Comment Utility
Above commands helped me partially.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In a hurry?.. scroll down to "HERE's HOW TO DO IT" Section. Greetings All, I was going to post this as question/solution, but its seems more appropriate as an article considering its length.  I felt it important to illucidate all the details c…
Many admins will agree: WSUS is is a nice invention but using it on the client side when updating a newly installed computer is still time consuming as you have to do several reboots and furthermore, the procedure of installing updates, rebooting an…
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…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now