15 Jan 2012

Resolving DNS Names with PowerShell 3.0

Posted by Juergen

I am currently working for a large Lotus Notes to Exchange Server 2010 migration project. The Exchange organization will have mailboxes using about 40 different primary SMTP email domains.

Last week I had to check if the AutoDiscover DNS entries have already been configured. I did not want to start NSLOOKUP and type 40 different names. This would be too time consuming and very likely I would make a few typing errors. I had a file with the AutoDiscover hostnames and I thought how I can automate the task. I could use a command prompt window and execute the following pipeline:

Type filename | nslookup

However, this was not what I was looking for, because very likely I have to create a nice table showing the DNS name and the corresponding IP address.

I searched how I can resolve DNS entries using PowerShell. Initially I was disappointed about my search result.

clip_image002

Figure 1: PowerShell Version 2

I could use the System.Net.Dns.GetHostAddresses method, but I found no method to resolve SRV records.

It looks like this issue will be fixed with PowerShell 3.0. On my Windows Server 8 system I found the new cmdlet Resolve-DnsName.

PowerShellVersion3ResolveDNSName

Figure 2: PowerShell Version 3

Comments are closed.

  • Browse

    or
  • Calendar

    November 2024
    M T W T F S S
     123
    45678910
    11121314151617
    18192021222324
    252627282930  
  • Tag Cloud

  • Categories