I have started to indulge myself with Powershell lately and this is a pretty handy script that I came up with, I wanted to change the dns servers and the gateway for some of my test servers remotely, so I was looking at how I could do it with my new found abilities!
Its a pretty simple script, nothing fancy and I am sure there are similar ones on the internet! So here goes..
As you can see above, I have stored my server list in a file called servers.txt and called that in a variable called $servers. Then I create different variable for the dns servers that I want to modify with the ip addresses and a new variable for the gateway.
Then I retrieve the active network card information using a WMI class and start a for loop to iterate through each item and modify it. Like I said pretty simple nothing out of the ordinary.