If (‘Interested’ -in ‘PowerShell’) {‘Are you Participating in the PowerShell.org Forums?’}

If you’re interested in PowerShell and you’re not participating in the forums at PowerShell.org, you’re missing out on an awesome opportunity to learn from others instead of having to re-invent the wheel each time you need to accomplish a task. If you’ve been using PowerShell for a while and you’re not participating in the forums, then you’re missing out on an opportunity to help others who are asking for your assistance.

Recently, a topic was posted in the forums about retrieving the fully qualified domain name and IP address information from a DNS server with PowerShell.

Here’s the solution I provided:

#Requires -Version 3.0
#Requires -Modules DNSClient
function Get-MrDNSInfo {

Returns the FQDN and IP Address information for one or more computers.

Get-MrDNSInfo is a function that returns the Fully Quailified Domain Name,
along with IPv4 and IPv6 information for one or more computers which is
retrieved from a Microsoft based DNS server.

.PARAMETER ComputerName
The computer(s) to retrieve FQDN and IP Address information for. The default is
the local computer.

The Microsoft based DNS Server to retrieve the FQDN and IP Address information
from. The default is a DNS Server named DC01.

Get-MrDNSInfo -ComputerName pc01, pc02, server01

Get-MrDNSInfo -ComputerName pc01, pc02, server01 -DNSServer MyDNSServer

'pc01', 'pc02', 'server01' | Get-MrDNSInfo

Get-Content -Path .\Computers.txt | Get-MrDNSInfo -DNSServer MyDNSServer



Author:  Mike F Robbins
Website: https://mikefrobbins.com
Twitter: @mikefrobbins

param (

[string[]]$ComputerName = $env:COMPUTERNAME,

[string]$DNSServer = 'dc01'


foreach ($Computer in $ComputerName) {
$DNSInfo = Resolve-DnsName -Server $DNSServer -Name $Computer -ErrorAction SilentlyContinue

NetBIOSName = $Computer
FQDN = $DNSInfo.Name | Get-Unique
IP4Address = $DNSInfo.IP4Address
IPV6Address = $DNSInfo.IP6Address



Where else could you receive this type of information for free? A nicely formatted, well documented, and easy to read and follow solution.

By the way, I’m speaking on What’s New in PowerShell Version 5 (Preview)? at TechStravaganza in Atlanta on Friday, June 6th (tomorrow).