In this tutorial, you will learn how to find the IP address and network adapter settings of a remote computer or server.
There are multiple ways to get the IP address of another computer by using PowerShell and Windows commands. I’ll show multiple examples of each.
In this article
- Find IP Address of Remote Computer using PowerShell
- Get the IP Address of Another Computer using Windows CMD Commands
Find IP Address of Remote Computer using PowerShell
There are multiple PowerShell cmdlets to get the IP address of a remote computer.
Option 1. Get IP Address using WMI (Direct Query of Remote Computer)
This first option will connect directly to a remote computer to get the IP address details.
This option requires WMI to be allowed inbound on the Windows Firewall.
If this is a domain joined computer, enable this for the Domain profile only.
Once you have the WMI Firewall rule enabled, use the below command. In this example, I’m going to get all of the IP address details for computer PC2 that have IP Enabled.
Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE -ComputerName pc2 | Select-Object -Property *
You can see it returns the IP of 192.168.100.21 for PC2.
As you can see the command returns a lot of information from the network adapter. You can use the select-object parameter to limit what is displayed.
To display only the IP Address use the below command.
Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE -ComputerName pc2 | Select-Object IpAddress
That is much easier to read.
Next, I’ll add the subnet mask, MAC Address, and DNS settings to the command.
Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE -ComputerName pc2 | Select-Object IPAddress,DNSServerSearchOrder,IPSubnet,MACAddress | Format-list
You can customize the output to display whatever adapter information you need.
Option 2. Get IP Address using Get-CimInstance (Direct Query of Remote Computer)
This option is very similar to option 1. Get-CimInstance is supposed to replace Get-WmiObject, but that will not happen anytime soon.
This option requires WinRM (PowerShell remoting) to be enabled. This is enabled by default on Windows servers but is not on client operating systems like Windows 10, 11.
To enable WinRM on a single computer you can open the command prompt in administrator mode and issue the WinRM quickconfig command. To enable it on multiple computers you will need to use group policy or intune.
When WinRM is enabled you can run the following command.
Get-CimInstance -ComputerName PC2 -ClassName Win32_NetworkAdapterConfiguration | Select-Object -Property *
This will get all network adapter details.
To get specific network adapter details use the select-object parameter.
In the below example, I will get the IP address of PC2.
Get-CimInstance -ComputerName PC2 -ClassName Win32_NetworkAdapterConfiguration | Select-Object ipaddress
Option 3. Get IP Address using Enter-PSSession cmdlet
If you have PowerShell Remoting enabled you can connect to the remote computer and run the ipconfig command.
This will create a session for the remote command. You can then enter any command as if you were sitting in front of the computer.
I’ll enter ipconfig to display the network adapter settings.
Option 4. Get the IP Address of Multiple Remote Computers
Using Get-CimInstance you can enter multiple computers to retrieve IP settings. In this example, I’ll get the IP Address from two remote computers.
Get-CimInstance -ComputerName srv-vm1,pc2 -ClassName Win32_NetworkAdapterConfiguration -Filter "IPEnabled = 'True'" | Select-Object ipaddress,PSComputerName
That completes the various options for PowerShell. Next, I’ll go over some Windows commands.
Get the IP Address of Another Computer using Windows CMD Commands
Just like PowerShell, there are multiple Windows commands you can use to get the IP Address of another computer.
Option 1. Ping Remote Computer (Indirect Query of IP Address)
The ping command will use DNS to lookup the computer’s IP address. This option can be less accurate as it does not directly query the computer for the IP address.
The good thing about this option is it is very easy, you do not need to modify firewall settings or enable any additional services.
This option will work even if the Firewall blocks ICMP requests (ping).
Open up the Windows command prompt or PowerShell and type the following command. Replace PC2 with your computer’s hostname.
In this example, I want the IP address of the remote computer PC2. You can see below the ping command resolves the hostname to IP 192.168.100.21. This is the IP address that DNS has for this computer. The drawback to this is, if DNS is wrong, you will not have the correct IP Address for the remote computer.
Option 2. Nslookup
You can directly query your DNS server to lookup the IP address of another computer.
This will work with internal computers joined to the domain or external domain names.
Option 3. PsExec (Direct query of IP Address)
Psexec cmd will create a session to the remote computer. You can then run commands as if you were sitting in front of the computer. You will need to be a local administrator on the remote computer for this command to work.
You first need to install psexec on your local computer.
Then run the command below.
psexec \\pc2 ipconfig
This will execute the ipconfig command on the remote computer and display it on your local computer.
One other option is to use IP Address Management Software (IPAM). An IPAM will auto track IP address usage on your network. It can automatically update which IP addresses are in use, which device, MAC Address info, and much more. You can also grant read access to helpdesk or other IT staff so they can easily lookup IP info on remote workstations or other devices on the network.
I wrote a detailed guide on the 5 best IPAM solutions to help you get and track IP Addresses on your network.
That’s a wrap.
In this article, I showed you several options on how to find the IP address of a remote computer.
I hope you enjoyed this article. If you have a question or comment leave it below.