---
title: "Troubleshoot Connectivity with Test-NetConnection"
description: "Solve network issues with ease. Learn how to utilize Test-NetConnection in PowerShell."
canonical: "https://adamtheautomator.com/test-netconnection/"
---

# Troubleshoot Connectivity with Test-NetConnection

> Solve network issues with ease. Learn how to utilize Test-NetConnection in PowerShell.

Source: https://adamtheautomator.com/test-netconnection/

---

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/)

![Troubleshoot Connectivity with Test-NetConnection](https://adamtheautomator.com/wp-content/uploads/2019/06/5d238ae5c824b514689ea5bc.jpg)

# Troubleshoot Connectivity with Test-NetConnection

[![](https://secure.gravatar.com/avatar/d0b9d42e21e5622713f8b693aa5c0f9244d5f7dd200ed29b8398f52dee5de337?s=192&d=mm&r=g)Adam Bertram](https://adamtheautomator.com/author/adam-bertram/)30 June 20193 min. read

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

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

Table of Contents

*   [Troubleshooting with Test-NetConnection](#how-to-troubleshoot-a-network-connectivity-problem-with-test-netconnection)
*   [Confirm Your Internet Connection](#confirm-your-internet-connection)
*   [Use Test-NetConnection to Test Your Connection to the Website Host](#test-your-connection-to-the-website-host)
*   [Ensure That Your TCP Port Is Open](#ensure-that-your-tcp-port-is-open)

Before the days of the PowerShell `Test-NetConnection` cmdlet, we had many different command-line tools we could choose from to troubleshoot various network connectivity issues.

Not a reader? Watch this related video tutorial!

**_Not seeing the video? Make sure your ad blocker is disabled._**

We had __ping__ for testing ICMP echoes and replies; __tracert__ to see where our packets might be getting dropped; __nslookup__ to perform DNS queries against our DNS servers; __telnet__ to check for open TCP ports, and various other utilities. There was a utility for everything.

With the introduction of [PowerShell](https://adamtheautomator.com/tag/powershell/) v4 on Windows 8.1 and Windows Server 2012 R2, this single-utility-for-a-single-task approach to [troubleshooting connectivity problems](https://www.ipswitch.com/application-and-network-monitoring/whatsup-gold?source=Content&details=Blog) has become obsolete.

Allow me to introduce you to the new, all-powerful `Test-NetConnection` cmdlet. Think of the PowerShell Test-NetConnection as ping, [tracert](https://adamtheautomator.com/traceoute-windows-10/ "tracert"), nslookup, telnet, and a few other utilities wrapped up into one suite of troubleshooting goodness.

## Troubleshooting with Test-NetConnection

Let’s see what we can do with the Powershell test-netconnection cmdlet and look at how we can use it when we’re in the unfortunate position of troubleshooting a network connectivity problem.

To demonstrate this, I’m going to use PowerShell `Test-NetConnection` to troubleshoot a common, real-world problem: “I can’t get to XYZ website!”

What most users don’t know is that successfully rendering a website in a browser is, itself, an amazing feat considering the number of moving pieces that have to work together to make that happen. At a minimum, the process entails:

*   Having an internet connection.
*   Having a route to your DNS server.
*   Contacting the DNS server to resolve the URL.
*   Having a route to the IP address the URL resolves to.
*   Having TCP port 80 open.
*   et cetera, et cetera .

## Confirm Your Internet Connection

To begin troubleshooting, you’ll first need to confirm that you have an internet connection. You can do this by simply running PowerShell `Test-NetConnection` with no parameters at all. However, if you’d like to get more information, I suggest using the `InformationLevel` parameter with the `Detailed` argument.

```powershell
Test-NetConnection -InformationLevel Detailed
```

This simple command checks your local connectivity and internet connectivity and confirms that your DNS client can resolve names directed at your DNS server all in one shot. Consider it a general health check for your network connection. This command checks three of the five processes needed to render a website in one fell swoop!

## Use Test-NetConnection to Test Your Connection to the Website Host

We’ll now need to direct our troubleshooting to the website host in question. Let’s use google.com as an example. You could also use a remote computer too.

We can use `Test-NetConnection` with the `ComputerName` parameter to simultaneously ensure that the website host can be resolved in DNS, that there’s a TCP route available to get to the IP address that the name resolves to, and that it can be pinged.

```powershell
Test-NetConnection -ComputerName google.com
```

Even though this step technically verifies we have a route to the google.com web server, I want to find more detailed information about which routers my packets are flowing through to get to the google.com web server. To do that, I’ll use the `TraceRoute` parameter to get a list.

```powershell
Test-NetConnection -ComputerName google.com -TraceRoute
```

## Ensure That Your TCP Port Is Open

Our final test is to ensure that the TCP port we’re expecting the web server to be running on is open. In this case, since we’re just specifying google.com, I’m going to assume it is TCP port 80. To do that, we’ll simply add another parameter to `Test-NetConnection`. Because `Test-NetConnection` understands the standard TCP port for a few different services, we don’t even need to know the port number. I can just pass HTTP to the `CommonTCPPort` parameter and it will do the work for me.

```powershell
Test-NetConnection -ComputerName google.com -CommonTCPPort HTTP
```

However, if the website might be running under a different port, such as 8080, you can specify a TCP port directly by using the `Port` parameter instead.

```powershell
Test-NetConnection -ComputerName google.com -Port 80
```

We’ve now tested each of the connectivity requirements outlined at the start of this article. If we still can’t render the website at this time, we’ve confirmed the problem does not lie with our client, and we can pass the problem on to Google or perhaps a downstream DNS server.

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Ftest-netconnection%2F&text=Troubleshoot%20Connectivity%20with%20Test-NetConnection)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Ftest-netconnection%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Ftest-netconnection%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/)
