How to Use Windows PowerShell and Command Prompt to Diagnose Network and System Errors

Use Command Prompt for quick network checks and PowerShell for deeper system evidence. Start with ipconfig, ping, and tracert, then switch to PowerShell when you need services, logs, adapters, and repeatable reports. Microsoft notes that ipconfig can show TCP/IP settings and refresh DHCP or DNS data [source: Microsoft].

TLDR: If the internet is broken, run ipconfig /all, ping 8.8.8.8, and nslookup google.com first. If a PC feels broken, use PowerShell commands like Get-EventLog, Get-Service, and Get-Process. Example: if 20 office PCs lose access to a file server, a 60-second check with Test-NetConnection ServerName -Port 445 can show whether the issue is DNS, routing, firewall, or the server itself. That is much faster than rebooting everything and hoping.

Windows gives you two built-in tools that can save a lot of wasted time: Command Prompt and Windows PowerShell. Command Prompt is blunt and fast. PowerShell is richer and better for collecting details. Honestly, it feels like Windows hides the useful clues in five different places, but these tools pull many of them into one window.

Start with the network basics

When a user says, “The internet is down,” do not start with the browser. Start with the machine’s network state.

  • ipconfig shows the IP address, subnet mask, gateway, and DNS servers.
  • ipconfig /all gives the full adapter details, including DHCP status and MAC address.
  • ipconfig /release and ipconfig /renew request a fresh address from DHCP.
  • ipconfig /flushdns clears the local DNS cache.
Read also :   Why macOS AirDrop Stopped Working Between iPhone and MacBook and the Firewall Profile Reset That Fixed Discovery

Watch for obvious trouble. An address starting with 169.254 often means the PC did not get a DHCP address. A missing default gateway usually means the device can talk locally but cannot reach the wider network. Wrong DNS servers can make websites fail even when the connection is fine.

Use ping to split the problem in half

ping is simple, but it is still one of the best first tests. It tells you if a device can reply.

  • ping 127.0.0.1 checks the local TCP/IP stack.
  • ping your gateway checks the local network path.
  • ping 8.8.8.8 checks outside access by IP.
  • ping google.com checks outside access plus DNS.

If ping 8.8.8.8 works but ping google.com fails, suspect DNS. If the gateway fails, suspect Wi-Fi, cable, VLAN, adapter settings, or the router. The catch is that some servers block ping, so a failed ping is not always proof that the host is down.

Trace slow or broken routes

Use tracert when a site is slow or unreachable, but other sites work.

tracert example.com

This shows each hop between your PC and the destination. Long delays near the start suggest a local or ISP issue. Timeouts near the end may belong to the remote network. Expect to waste time if you treat every timeout as a failure. Some routers simply refuse to answer trace requests.

Read also :   What Does SLS Mean on Twitch? Explained

Check DNS with nslookup

DNS problems are sneaky. The browser says “site cannot be reached,” but the real issue may be name resolution.

Run:

  • nslookup example.com
  • nslookup example.com 8.8.8.8

The first command uses your configured DNS server. The second asks Google DNS directly. If the second works and the first fails, your local DNS server may be stale, blocked, or misconfigured.

Bring in PowerShell for stronger tests

PowerShell can do many CMD-style tests, but with more detail. A favorite is Test-NetConnection.

  • Test-NetConnection google.com checks basic reachability.
  • Test-NetConnection fileserver01 -Port 445 checks SMB file sharing.
  • Test-NetConnection mail.company.com -Port 443 checks HTTPS access.

This is useful because a server can respond to ping while the needed service port is blocked. That tiny difference matters. It can save a support ticket from going to the wrong team.

Inspect adapters and IP settings

PowerShell gives clean commands for adapter checks:

  • Get-NetAdapter shows adapters and link status.
  • Get-NetIPConfiguration shows IP settings in a readable format.
  • Get-DnsClientServerAddress shows DNS servers per adapter.

If Wi-Fi says “Up” but the IP settings are blank, the adapter is connected without a valid network setup. If the wrong DNS server appears, fix DHCP or set the correct server manually.

Look for system errors in logs

Network errors are not always network errors. A broken driver, failed service, or overloaded process can look like one.

Read also :   How to Fix Dev Error 7222 in Warzone & Black Ops 6

Use these PowerShell commands:

  • Get-Service | Where-Object {$_.Status -eq "Stopped"}
  • Get-Process | Sort-Object CPU -Descending | Select-Object -First 10
  • Get-EventLog -LogName System -EntryType Error -Newest 20

The last command is especially helpful after a crash, failed update, or sudden network drop. Look for driver resets, disk warnings, service failures, and authentication errors.

Goods and Services

Create a quick diagnostic report

For repeat problems, save results to a file. This makes comparisons easier.

Get-NetIPConfiguration > C:\Temp\network-report.txt

Test-NetConnection fileserver01 -Port 445 >> C:\Temp\network-report.txt

Get-EventLog -LogName System -EntryType Error -Newest 20 >> C:\Temp\network-report.txt

Now you have a small report you can send to IT or keep for the next outage. It beats screenshots. It also keeps the facts intact.

Best order for troubleshooting

  1. Check IP settings with ipconfig /all.
  2. Ping the gateway to test local access.
  3. Ping an external IP to test internet routing.
  4. Test DNS with nslookup.
  5. Test the exact port with Test-NetConnection.
  6. Check services and logs if the network looks fine.

These commands will not fix every issue by themselves. Still, they tell you where the fault probably lives. That is the real win. Once you know whether the problem is DHCP, DNS, routing, a blocked port, or Windows itself, you stop guessing and start fixing.