Trying to write the output of the command Resolve-DnsName -Name abc.com
to a txt/csv file without the headers.
PS C:\> Resolve-DnsName -name mjf.ie | Select-Object name,type,IPAddress
Name Type IPAddress
---- ---- ---------
abc.com A 199.181.132.250
when I try to writ the output to a txt file, I get the headers.
Tried the following different options
$dnsnames = Get-Content "E:\dns\dummydns.txt"
foreach ($name in $dnsnames){
echo $name A >>"E:\dns\dnsoutput-demo.csv"
Resolve-DnsName -Name $name -Type A >>"E:\dns\dnsoutput-demo.csv"
Resolve-DnsName -Name $name -Type txt >>"E:\dns\dnsoutput-demo.csv"
# 0 Resolve-DnsName -Name $name | Select-Object -Property name,type,IPAddress | out-file -append -filepath "E:\dns\dnsoutput-demo.csv"
# 1 Resolve-DnsName -Name $name | Select-Object -Property name,type,IPAddress | out-file -append -filepath "E:\dns\dnsoutput-demo.csv"
# 2 Resolve-DnsName -Name $name | Select-Object -Property name,type,IPAddress | Export-Csv -append -path "E:\dns\dnsoutput-demo.csv"
# 3 Resolve-DnsName -Name $name -Type txt >>"E:\dns\dnsoutput-demo.csv"
echo "Next Entry" | out-file -append -filepath "E:\dns\dnsoutput-demo.csv"
}
Anyone know how I can just get the output of the name,type,IPAddress or individually...