Skip to content

Instantly share code, notes, and snippets.

@v-2vinty
v-2vinty / gist:097b1a1378c3bef1192c77543809a9a4
Created May 10, 2019 08:04
script to modify DNS server IP on multiple windows clients at once.
$computer = get-content c:\temp\servers.txt
foreach ($comp in $computer)
{
try{
$a = (Get-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName $comp -ErrorAction Stop | Where-Object {$_.ipenabled -eq "true"}).InterfaceIndex
Invoke-Command -ComputerName $comp -ScriptBlock {param( $b) netsh interface ip delete dns name=$b 10.10.220.1 } -args $a -ErrorAction Stop
}
catch
{