---
title: "PowerShell Remote Connection Testing: Practical Examples"
description: "Master remote connection testing with PowerShell using Test-NetConnection and Test-Connection."
canonical: "https://adamtheautomator.com/powershell-test-remote-connection/"
---

# PowerShell Remote Connection Testing: Practical Examples

> Master remote connection testing with PowerShell using Test-NetConnection and Test-Connection.

Source: https://adamtheautomator.com/powershell-test-remote-connection/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![PowerShell Remote Connection Testing: Practical Examples](https://adamtheautomator.com/wp-content/uploads/2019/07/photo-1544197150-b99a580bb7a8.jpg)

# PowerShell Remote Connection Testing: Practical Examples

[![](https://secure.gravatar.com/avatar/f5eee346b2d24820508eb95377d889e74e9ee47a78422b1f5c053fbc65cdfb09?s=192&d=mm&r=g)Matt Browne](https://adamtheautomator.com/author/matt/)25 July 20193 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[PowerShell](/tag/powershell/)

Table of Contents

*   [PowerShellified Ping?](#powershellified-ping)
*   [Test-Connection](#test-connection)
*   [Test-NetConnection](#test-netconnection)
*   [Summary](#summary)

Pinging a device is a basic skill of any system administrator, and we all know the _ping.exe_ command but have you heard of the PowerShell commands `Test-Connection` and `Test-NetConnection`? It’s PowerShell’s way of injecting the old-school [_ping.exe_ command](https://docs.microsoft.com/en-us/troubleshoot/windows-client/networking/ping-exe-check-microsoft-broadband-network-adapter) with steroids! Let’s break out some PowerShell to test a remote connection and more in this blog post.

Pinging a computer is really easy to do in [PowerShell but there are a set of options](https://adamtheautomator.com/powershell-scheduled-task/) that really make it useful, and take it way beyond what _ping_ can do.

## PowerShellified Ping?

Although old-school _ping_ is a legacy tool, it’s still around and can be invoked with PowerShell just like any other cmd utility can. It can be executed either directly by typing `ping <hostname>` or you can also use the [`Invoke-Expression`](https://adamtheautomator.com/invoke-expression/ "Invoke-Expression") cmdlet to call _ping.exe_ but this is just putting lipstick on a pig.

```powershell
PS51> Invoke-Expression -Command "ping.exe google.com"
```

![Invoke-Expression example](/wp-content/uploads/2019/07/img_5b78614056919.png)

Invoke-Expression example

This works and you’ll get the normal _ping_ results back, but it’s a bit clunky and all you get is the text output from the _ping_ command. Let’s use the native PowerShell cmdlet [`Test-Connection`](https://adamtheautomator.com/powershell-test-connection/ "Test-Connection") instead.

## Test-Connection

```powershell
PS51> Test-Connection www.google.com
```

![PowerShell Test-Connection](/wp-content/uploads/2019/07/img_5b783946c5d41.png)

Running Test-Connection

That’s a much more native way of doing it in PowerShell, and it returns an object rather than just the text output of _ping.exe_.

If you pipe the object coming from the PowerShell `Test-Connection` cmdlet into `Select-Object -Property *` we get a mass of useful information.

```powershell
PS51> Test-Connection www.google.com | Select-Object -Property *
```

![Inspecting all object properties returned from Test-Connection](https://adamtheautomator.com/wp-content/uploads/2020/07/img_5b783a8708bc5-1024x266-1.png)

Inspecting all object properties returned from Test-Connection

Like any good PowerShell cmdlet we have switches so we can set things like `Count` for the number of attempts, `BufferSize` for the size of the packet and `Delay` to define the delay between each attempt and use PowerShell to test a remote connection like a boss.

```powershell
PS51> Test-Connection www.google.com -Count 2 -BufferSize 128 -Delay 3
```

There are a lot of other parameters you can use but I’m not going to go through them all. But there are some parameters that are useful like `Source`. The `Source` parameter makes it possible to use the PowerShell `Test-Connection` cmdlet to connect to other machines on your network and initiate connection attempts from there.

```powershell
PS51> Test-Connection -Source "LocalHost", "TestVM01", "TestVM02" -ComputerName "www.google.com"
```

![Testing connection on multiple hosts with the Source parameter](/wp-content/uploads/2019/07/img_5b78473bb209b.png)

Testing connection on multiple hosts with the Source parameter

The output shows all the results from the hosts in the source list, in one nice neat table containing objects. This is especially useful if you have a complicated network with lots of firewalls between you and the target. As long as you can get to those source machines then you can test any of the connections from there.

The `Quiet` parameter goes the other way and gives a really simple true/false result. This is super useful when using it in _if_ statements.

```powershell
PS51> Test-Connection www.google.com -Quiet
```

![Using the Quiet parameter](/wp-content/uploads/2019/07/img_5b7849eeda7aa.png)

Using the Quiet parameter

If you have a lot of targets to test then the `AsJob` parameter might be useful for putting the list to a background job and getting the results using `Get-Job | Receive-Job`.

```powershell
PS51> Test-Connection google.com -count 10 -AsJob
PS51> Get-Job | Receive-Job
```

![Using Test-Connection with a background job](/wp-content/uploads/2019/07/img_5b784eb8af113.png)

Using Test-Connection with a background job

## Test-NetConnection

Another cmdlet to look at is [`Test-NetConnection`](https://adamtheautomator.com/test-netconnection/ "Test-NetConnection"). The `Test-NetConnection` cmdlet can test the connection to a device much like the PowerShell `Test-Connection` cmdlet but it’s a little more networking focused. In the simplest sense, it gives much the same results.

```powershell
PS51> Test-NetConnection www.google.com
```

![Using Test-NetConnection](/wp-content/uploads/2019/07/img_5b78529ad5808.png)

Using Test-NetConnection

Again this cmdlet has a load of really useful parameters like `Port` to test whether a remote port is open or not.

```powershell
PS51> Test-NetConnection www.google.com -Port 80
```

![Testing port connectivity](/wp-content/uploads/2019/07/img_5b7854b6cc763.png)

Testing port connectivity

With the `TraceRoute` parameter you can do the same as you would with _[tracert](https://adamtheautomator.com/traceoute-windows-10/ "tracert").exe_, but the output is a PowerShell object with each of the hops on the route to the target.

```powershell
PS51> Test-NetConnection www.google.com -TraceRoute
```

![Using Test-NetConnection for tracing routes](/wp-content/uploads/2019/07/img_5b7856a3e8ed5.png)

Using Test-NetConnection for tracing routes

Again, if you want to use PowerShell cmdlet `Test-NetConnection` in an _if_ statement to test if a device has port 80 open you can use the `-InformationLevel Quiet` parameter/value to give you a simple true/false result from the test.

```powershell
PS51> Test-NetConnection www.google.com -port 80 -InformationLevel Quiet
```

If you’d like an advanced example of using these cmdlets, I highly encourage you to check out the post _[An All-in-One PowerShell Server Port Testing Tool](https://adamtheautomator.com/powershell-test-port/)_.

## Summary

Whether you choose to use the PowerShell `Test-Connection` cmdlet or `Test-NetConnection` cmdlet, we’ve got you covered! Using one or both of these cmdlets will allow you to use PowerShell to test a remote connection with no problem at all many different ways!

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fpowershell-test-remote-connection%2F&text=PowerShell%20Remote%20Connection%20Testing%3A%20Practical%20Examples)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fpowershell-test-remote-connection%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fpowershell-test-remote-connection%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2026/06/26995-troubleshoot-dns-issues-powershell-codex.webp)

### [Troubleshoot DNS Issues with PowerShell](/troubleshoot-dns-issues-powershell/)

Troubleshoot DNS issues with PowerShell by testing name resolution, DNS client settings, cache entries, and network connectivity in a repeatable workflow.

![](https://adamtheautomator.com/wp-content/uploads/2025/10/image_2025-10-24_095322075.png)

### [Migrating from PowerShell 6 to 7.5: Breaking Changes/New Features](/migrating-powershell-6-to-7-5/)

Migrate from PowerShell Core 6 to 7.5: breaking changes, features, and testing tips.

![](https://adamtheautomator.com/wp-content/uploads/2025/06/featured-image-6.png)

### [How to Add Timeouts to Pester Tests with PowerShell Runspaces](/pester-test-timeout-runspaces/)

Prevent Pester tests from hanging indefinitely using PowerShell runspaces. Learn to handle variable scoping, module loading, TestDrive access, and stream capture challenges with timeout protection.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
