This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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 | |
{ |