I have the code at the bottom of this message. Ideally, I want the code to take a list of domain names, and output the domain name next to the IP address it resolves to in a CSV file. So output needs to be:
domain
IP it's resolving to
I have the following code which I can get to run but no idea how to resolve what I need to a csv - however you need to treat me like a child with this:
$names=get-content “C:\users\desktop\addresses.txt”
foreach($name in $names) {
resolve-dnsname $name}
You can go back and edit your existing post. You don’t have to create a new one.
Thanks in advance.
The output you get from Resolve-DnsName depends pretty much on the input. If you provide “internal” addresses the output looks different to when you provide internet addresses like “www.bing.com” for example. In the easiest case something like this could be enough: