Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-04-10
3
Medium Priority
?
943 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 1500 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 1500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
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…
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…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

916 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