This cmdlet is part of the Vexasoft Cmdlet Library. You can download it now or click here to find out more.

Resolve-Host

Synopsis

Resolves a host name or IP address using DNS.

Syntax

  • Resolve-Host [-HostName]

Description

The Resolve-Host cmdlet is used to resolve host names or IP addresses using the local computer's DNS settings.

Parameters

  • HostName The name or IP address to resolve.

Inputs

Resolve-Host accepts pipeline input for the HostName parameter and will attempt to resolve any objects passed to it.

Outputs

Resolve-Host returns a HostRecord object detailing the final resolved name and IP address of the requested host name. If the host name cannot be resolved, a host record is still returned, but with the missing information set to $null. If multiple IP addresses are registered to a single host name, multiple HostRecords are returned.

Notes

There are no notes associated with the Resolve-Host cmdlet.

Example 1

This command will resolve www.vexasoft.com using the local computer's DNS client and return a host record object detailing the host name and resolved IP address:

C:\PS>Resolve-Host www.vexasoft.com

Example 2

Several hosts can be specified at once to the cmdlet. This command will return host record objects with details of resolved IP addresses for PC01 and PC02:

C:\PS>Resolve-Host PC01, PC02

Example 3

Resolve-Host can be used to do reverse lookups, resolving IP addresses to host names:

C:\PS>Resolve-Host 192.168.1.44

Example 4

Resolve-Host accepts pipeline input and will attempt to resolve any strings passed to it:

C:\PS>Get-Content .\ServerList.txt | Resolve-Host