Perform an NSLookup in PowerShell to find the IP Address(es) tied to a hostname

Scenario:  You want to perform an NSLookup in PowerShell so you can use the multiple IP addresses that you are using for DNS Round Robin in another PowerShell Query.

Solution: Run the following:

#Collect the IP Addresses of the hostname into a variable
$address = []::GetHostAddresses("" | Select IPAddressToString)

#For Each Loop it with a command
$address | Select -expandproperty IPAddressToString | %{ Get-ADComputer $_ }



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: