You agree to the usage of cookies when you continue using this site. Usage of cookies: In order to optimize the website and for continuous improvement uses cookies. Please don't let me fall to stupidity or ignorance, I expect the absolute best in each and every one of you and I hope you expect the same of me. I am a man made out of my environment, and you are the ones creating who I am. please do everything in your power to correct me if I saying or doing something wrong, or inform me of what I could be doing better. Warning: Everything I say and do in these blogs or videos are subject to mistake and criticism. Author is not liable for any damages whatsoever arising out of the use of or inability to use the sample scripts or documentation. Get-ADComputer -Filter * | foreach ĭisclaimer: All the steps and scripts shown in my posts are tested on non-production servers first. All the scripts provided on my blogs are comes without any warranty, The entire risk and impacts arising out of the use or performance of the sample scripts and documentation remains with you. Credential = This is another optional parameter and here you can add credentials to connect remotely or locally.Īnother way of performing same task on multiple system, Here in below example I am fetching computer names from active directory domain controller and updating IP on those servers with foreach loop. By default it connects using Dcom and does not require any special configuration. DnsIP = here you can put multiple ip in array with = This is optional and Dcom (Remote procedure call - RPC) or WSman (Windows Powershell remoting need to be enabled) can be used here. NetworkName = Type network physical adapter name here which is found under network connections, in most of the cases it will named as Ethernet. \Set-DnsIP.ps1 -Name DSC01 -NetworkName Ethernet -DnsIPs = Put computername here For simplicity I am running this command directly from domain joined server logged in with domain admin username and password, So there is no requirement to mention credentials. Next by running below command I will replace existing DNS IPs and it also verify it and shows result on console. Run Set-ExecutionPolicy Unrestricted, so ps1 scripts are allowed to execute. If you check on windows 2012 and above server OS, physical network adapter is named as Ethernet by default, unless it is modified.Ĭopy script in the Set-DnsIP.ps1 file, I have kept file on root c:\ drive. As it can be seen in below screenshot, There are 2 Nics In my environment, on all the server and I wanted to change DNS IPs on physical adapter with name Ethernet only.
Same task I performed but this time to replace DNS ips on an average 6000 remote windows servers. I used this script again after long time to change/update DNS ip addresses on remote Windows servers, after introducing my new upgraded DNS servers.
Although I had written this script around 4 years back I have again revised it to work it in more better way with status report on console.