Solved

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

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

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…
Have you ever had a hard drive that you can't boot into, but need to change the registry? Here is the solution! This article guides you through accessing and editing a registry of a non-primary drive. To read registry information on a non-prim…
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…

776 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