#@
#based on our name convention eg. CHxxxxxx
#create the file with the servers
#$target = Get-ADComputer -filter * | Where-Object name -Like ‘CH*’ | Select-Object name | Out-File
$StartTime = (Get-Date)
#read the file that countains the servernames
$target = Get-Content
foreach($servername in $target){
if (Test-Connection $servername -Count 1 -Quiet){
$servername | out-file
Get-DnsClientServerAddress -AddressFamily IPv4 | Select-Object –ExpandProperty ServerAddresses | out-file
“####################” | out-file
}
}
write-host “Script ran for : “$([timespan]::fromseconds(((Get-Date)-$StartTime).Totalseconds).ToString(“mm\:ss”))