PS1 Array DNS Query Better Layout Help

Captain,
Welcome to the forum. :wave:t4:

Before we start … when you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
Thanks in advance

I’m confused - you have two independend loops and in booth loops you’re using a variable $dnsServer. But I don’t see where you define it.
Then - if you want to have the output as CSV file you should use Export-Csv - it is made for.
Then - in both loops you use the same query twice. But once even without saving the output to a variable. So you actually only waste time and cpu cycles with this command. :wink:

You may share a sample of your input files as well (formatted as code). This way we may be able help you better.