As per the title, find the DNS addresses from a text list of servers:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
#Get the DNS for a List of Servers #Get the admin permissions $LoginPassword = Get-Credential #Get the list of computers from a text file $computer = get-content C:\temp\servers.txt #Get the DNS IP's using the get-wmiobject (using wmi as some servers dont have powershell installed) $NICs = Get-WMIObject Win32_NetworkAdapterConfiguration -computername $computer -Credential $LoginPassword |where{$_.IPEnabled -eq “TRUE”} # for each server list the current setting Foreach($NIC in $NICs) { Write-Host "DNS Servers:" $NIC.DNSHostName $NIC.DNSServerSearchOrder } |
Leave a Reply