{"id":2132,"date":"2026-05-06T12:50:13","date_gmt":"2026-05-06T12:50:13","guid":{"rendered":"https:\/\/www.exam-topics.com\/blog\/?p=2132"},"modified":"2026-11-04T18:00:15","modified_gmt":"2026-11-04T18:00:15","slug":"top-3-powershell-cmdlets-for-checking-network-connectivity","status":"publish","type":"post","link":"https:\/\/www.exam-topics.com\/blog\/top-3-powershell-cmdlets-for-checking-network-connectivity\/","title":{"rendered":"Top 3 PowerShell Cmdlets for Checking Network Connectivity\u00a0"},"content":{"rendered":"<p>Three useful PowerShell commands for Windows network troubleshooting are <code>Test-Connection<\/code>, <code>Test-NetConnection<\/code>, and <code>Resolve-DnsName<\/code>. They answer different questions: can the host respond to an ICMP probe, can a specific TCP service be reached, and what does DNS return for a name? Using them in that order is helpful in some incidents, but the right starting point depends on the symptom.<\/p>\n<p><strong>Scope matters:<\/strong> <code>Test-Connection<\/code> is available in Windows PowerShell and modern PowerShell, although its parameter sets differ by version. <code>Test-NetConnection<\/code> belongs to the Windows NetTCPIP module, and <code>Resolve-DnsName<\/code> to the Windows DnsClient module. Neither Windows module should be assumed available on an arbitrary macOS or Linux installation of PowerShell.<\/p>\n<h2>1. Test-Connection: start with IP reachability<\/h2>\n<p><code>Test-Connection<\/code> sends ICMP echo requests and can return structured results suitable for scripts. In supported PowerShell versions a simple positional invocation is:<\/p>\n<pre><code>Test-Connection example.com -Count 2<\/code><\/pre>\n<p>Run it against a host you administer or are authorized to test. A successful reply suggests that the remote system or an intermediate device responded to the probe. It does <strong>not<\/strong> prove that the web application, its authentication flow or a particular TCP port is working. Likewise, a timeout does not prove the host is offline: firewalls, network policies or devices may block or rate-limit ICMP.<\/p>\n<p>In PowerShell 7, <code>Test-Connection<\/code> also has a TCP-port test parameter set, including <code>-TcpPort<\/code>. That parameter is not a universal substitute for Windows PowerShell 5.1 syntax. Check your installed version with <code>$PSVersionTable.PSVersion<\/code> and the available parameters with <code>Get-Help Test-Connection -Full<\/code> before reusing scripts from another environment.<\/p>\n<h2>2. Test-NetConnection: test a specific service port on Windows<\/h2>\n<p><code>Test-NetConnection<\/code> can show Windows route and connection diagnostics and perform a TCP connection attempt. This example checks whether an HTTPS port is reachable:<\/p>\n<pre><code>Test-NetConnection -ComputerName example.com -Port 443<\/code><\/pre>\n<p>Review <code>TcpTestSucceeded<\/code> and the resolved address. A successful TCP handshake is narrower than a successful application request: TLS certificate validation, reverse-proxy routing, user authorization and the actual HTTP response may still fail.<\/p>\n<p>For additional route or interface details on Windows, use an appropriate <code>-InformationLevel Detailed<\/code> invocation. The exact fields depend on the command&#8217;s parameter set and the available network interface information. Do not infer that all intermediate firewalls are healthy solely because one endpoint accepts a TCP connection.<\/p>\n<h2>3. Resolve-DnsName: examine the name-resolution answer<\/h2>\n<p>If the hostname resolves to the wrong address\u2014or does not resolve at all\u2014testing ports against it may lead you to the wrong system. <code>Resolve-DnsName<\/code> queries DNS and can select a specific record type:<\/p>\n<pre><code>Resolve-DnsName -Name example.com -Type A\nResolve-DnsName -Name example.com -Type AAAA<\/code><\/pre>\n<p>The <code>A<\/code> query requests IPv4-address records, while <code>AAAA<\/code> requests IPv6-address records. For troubleshooting split-horizon DNS or a recent record change, compare the output from the intended resolver with the output of another resolver you are authorized to query. Check record TTL, local name-resolution policy and whether a VPN changes the DNS servers in use. Do not confuse a DNS lookup result with proof that the returned service is reachable.<\/p>\n<h2>A practical decision sequence<\/h2>\n<table>\n<thead>\n<tr>\n<th scope=\"col\">Symptom<\/th>\n<th scope=\"col\">First useful check<\/th>\n<th scope=\"col\">What the result does not establish<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>The hostname returns the wrong or no IP address<\/td>\n<td><code>Resolve-DnsName<\/code> for A\/AAAA and the intended DNS server<\/td>\n<td>Whether the server or application is healthy<\/td>\n<\/tr>\n<tr>\n<td>The IP address is known but basic network connectivity is uncertain<\/td>\n<td><code>Test-Connection<\/code> to the IP address<\/td>\n<td>Whether ICMP is permitted or a TCP service is available<\/td>\n<\/tr>\n<tr>\n<td>The website resolves but the service appears unavailable<\/td>\n<td><code>Test-NetConnection<\/code> to TCP port 443 on Windows<\/td>\n<td>Whether TLS or application-level requests will succeed<\/td>\n<\/tr>\n<tr>\n<td>One network works but the VPN or branch network does not<\/td>\n<td>Compare DNS answers, interfaces, routes and policy from each location<\/td>\n<td>Where the issue originates without tracing the actual path<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Walk through a failed web connection without guessing<\/h2>\n<ol>\n<li>Record the affected URL, time, client subnet and whether the issue occurs for other users.<\/li>\n<li>Run <code>Resolve-DnsName<\/code> against the hostname. Confirm the expected record type and IP address.<\/li>\n<li>Test the resolved IP and note whether ICMP is deliberately blocked. Use the site&#8217;s <a href=\"https:\/\/www.exam-topics.com\/blog\/fixing-a-failed-ping-request-a-troubleshooting-guide\/\">failed-ping troubleshooting guide<\/a> for common reasons an echo request gets no reply.<\/li>\n<li>On Windows, run <code>Test-NetConnection<\/code> against the actual service port. Note the interface and source address if the result is unexpected.<\/li>\n<li>If the TCP connection succeeds but the application still fails, inspect the TLS negotiation, HTTP status, reverse-proxy and application logs. These are separate checks, not additional uses of ping.<\/li>\n<li>Compare results from one known-good client and one affected client before changing DNS, routing or firewall policy.<\/li>\n<\/ol>\n<h2>Check the command reference for your environment<\/h2>\n<p>Microsoft documents <code>Test-Connection<\/code> in PowerShell 7, <code>Test-NetConnection<\/code> on Windows, and <code>Resolve-DnsName<\/code> on Windows. Use these versioned references instead of copying a flag from a different PowerShell release or operating system.<\/p>\n<p><strong>Takeaway:<\/strong> ICMP reachability, TCP service connectivity, and DNS resolution are three different tests. Combine the result of each with the actual application symptom; no single successful command is a complete network-health certificate.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Three useful PowerShell commands for Windows network troubleshooting are Test-Connection, Test-NetConnection, and Resolve-DnsName. They answer different questions: can the host respond to an ICMP probe, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"et_vendor":[22],"et_program":[],"et_certification":[],"et_exam":[],"et_topic":[20],"class_list":["post-2132","post","type-post","status-publish","format-standard","hentry","category-post","et_vendor-microsoft","et_topic-networking"],"_links":{"self":[{"href":"https:\/\/www.exam-topics.com\/blog\/wp-json\/wp\/v2\/posts\/2132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.exam-topics.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.exam-topics.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.exam-topics.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.exam-topics.com\/blog\/wp-json\/wp\/v2\/comments?post=2132"}],"version-history":[{"count":3,"href":"https:\/\/www.exam-topics.com\/blog\/wp-json\/wp\/v2\/posts\/2132\/revisions"}],"predecessor-version":[{"id":7143,"href":"https:\/\/www.exam-topics.com\/blog\/wp-json\/wp\/v2\/posts\/2132\/revisions\/7143"}],"wp:attachment":[{"href":"https:\/\/www.exam-topics.com\/blog\/wp-json\/wp\/v2\/media?parent=2132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.exam-topics.com\/blog\/wp-json\/wp\/v2\/categories?post=2132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.exam-topics.com\/blog\/wp-json\/wp\/v2\/tags?post=2132"},{"taxonomy":"et_vendor","embeddable":true,"href":"https:\/\/www.exam-topics.com\/blog\/wp-json\/wp\/v2\/et_vendor?post=2132"},{"taxonomy":"et_program","embeddable":true,"href":"https:\/\/www.exam-topics.com\/blog\/wp-json\/wp\/v2\/et_program?post=2132"},{"taxonomy":"et_certification","embeddable":true,"href":"https:\/\/www.exam-topics.com\/blog\/wp-json\/wp\/v2\/et_certification?post=2132"},{"taxonomy":"et_exam","embeddable":true,"href":"https:\/\/www.exam-topics.com\/blog\/wp-json\/wp\/v2\/et_exam?post=2132"},{"taxonomy":"et_topic","embeddable":true,"href":"https:\/\/www.exam-topics.com\/blog\/wp-json\/wp\/v2\/et_topic?post=2132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}