How to get a remote servers’ TCP/IP configuration: IP, DNS, GW via PowerShell

Hi

When you need to know the DNS configurations of a remote machine without logging in to that machine.  Using a script that can do the job on remote computers is the answer.

There are some very good Ebooks online that can teach you how to do this.

This nice Powershell script will do the work. The source I found on this web site and changed it for my needs.

$Computer = Read-Host Please Enter Host name
  Get-WMIObject Win32_NetworkAdapterConfiguration -Computername $Computer | `
  Where-Object {$_.IPEnabled -match "True"} | `
  Select-Object -property DNSHostName,ServiceName,@{N="DNSServerSearchOrder";
              E={"$($_.DNSServerSearchOrder)"}},
              @{N='IPAddress';E={$_.IPAddress}},
              @{N='DefaultIPGateway';E={$_.DefaultIPGateway}} | FT

If the DNSServerSearchOrder obscures some of the data, you can drop the “| FT” at the end of the script to get this output:



	

One thought on “How to get a remote servers’ TCP/IP configuration: IP, DNS, GW via PowerShell”

  1. Hi B.
    just change the script to:

    $Computer = Get-Content c:\list.txt
    foreach ($i in $Computer) {
    Get-WMIObject Win32_NetworkAdapterConfiguration -Computername $Computer | `
    Where-Object {$_.IPEnabled -match "True"} | `
    Select-Object -property DNSHostName,ServiceName,@{N="DNSServerSearchOrder";
    E={"$($_.DNSServerSearchOrder)"}},
    @{N='IPAddress';E={$_.IPAddress}},
    @{N='DefaultIPGateway';E={$_.DefaultIPGateway}} | FT }

Leave a Reply