How to select specified value from resolve-dnsname result?

Daniel Sajdyk 41 Reputation points
2021-03-11T07:53:02.743+00:00

Hello
I have domain with multiple domain controllers.

When I use:
Resolve-dnsname "my_domain"
I got result with type Selected.Microsoft.DnsClient.Commands.DnsRecord_A contains all of them.

No I want to select ony specified controllers from this list - for example I want controller which is second and fifth on that list.

How can I do that?

Best Regards
Daniel

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2021-03-11T09:05:50.557+00:00

    Hi @Daniel Sajdyk ,

    To select the specified items you can try something like this

    $records = Resolve-dnsname "my_domain"  
    $selected = $records[1], $records[4]  
    $selected  
    

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Daniel Sajdyk 41 Reputation points
    2021-03-11T09:23:15.65+00:00

    Great :) Thank you :)

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.