#Input file is CSV file with headers IPaddress
$Computers = import-csv “c:\temp\servers.csv”
ForEach ($Computer in $Computers) {
Write-Host “$($Computer.IPAddress): ” -ForegroundColor Yellow
Invoke-Command -ComputerName $Computer.IPAddress -ScriptBlock {
#input Cirrect DNS IP’S in the feals
$NewDnsServerSearchOrder = “10.10.1.200”,”10.10.1.106″
$Adapters = Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object {$_.DHCPEnabled -ne ‘True’ -and $_.DNSServerSearchOrder -ne $null}
# Show DNS servers before update
Write-Host "Before: " -ForegroundColor Green
$Adapters | ForEach-Object {$_.DNSServerSearchOrder}
# Update DNS servers
$Adapters | ForEach-Object {$_.SetDNSServerSearchOrder($NewDnsServerSearchOrder)} | Out-Null
# Show DNS servers after update
$Adapters = Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object {$_.DHCPEnabled -ne 'True' -and $_.DNSServerSearchOrder -ne $null}
Write-Host "After: " -ForegroundColor Green
$Adapters | ForEach-Object {$_.DNSServerSearchOrder}
}
}
Usually I do not read post on blogs, but I wish to say that this write-up very pressured me to check out and do it! Your writing style has been surprised me. Thanks, very great post.
Real great info can be found on site. “Even if happiness forgets you a little bit, never completely forget about it.” by Donald Robert Perry Marquis.
Thanx for the effort, keep up the good work Great work, I am going to start a small Blog Engine course work using your site I hope you enjoy blogging with the popular BlogEngine.net.Thethoughts you express are really awesome. Hope you will right some more posts.
so much excellent information on here, : D.