PowerShell has taken the Windows command line to the next level. It’s not just for automating admin tasks, but also for troubleshooting common Windows issues. Whether you’re managing files, setting up network stuff, or fixing system problems, the right PowerShell commands can make your life a lot easier. Let’s look at 6 PowerShell commands that can help you troubleshoot Windows like a pro.

6 Check disk health

Replace unhealthy disks while there's time

When a hard disk starts showing signs of trouble, replacing it before it completely fails is crucial. But figuring out which disk to replace isn’t always straightforward. Windows might alert you that a disk is unhealthy, but identifying the exact physical disk can be tricky. This is where PowerShell comes in handy. It can help you check disk health and pinpoint the problematic disk quickly and accurately.

The first step in identifying an unhealthy disk is checking if Windows has flagged any disks as problematic. The easiest way to do this is by opening PowerShell and running the Get-PhysicalDisk cmdlet. This command will display the health status of all the disks.

If your server has many disks, you can narrow down the output to show only the unhealthy ones by using the following command:

Get-PhysicalDisk | Where-Object {$_.HealthStatus -ne 'Healthy'}

Once you’ve identified an unhealthy disk, you can use its friendly name to light up the disk’s LED indicator, making it easier to locate the exact physical drive.

5 Test system performance

Check which processes are slowing down your PC

PowerShell provides several built-in cmdlets to diagnose and test system performance that can give you valuable insights into resource usage, running processes, and system performance. Use the Get-Process cmdlet to list all running processes. This helps you monitor which processes are using system resources like CPU, memory, and disk.

You can sort the processes by CPU usage to identify resource-heavy processes:

Get-Process | Sort-Object CPU -Descending

Similarly, to see which processes are using the most memory:

Get-Process | Sort-Object WorkingSet -Descending

If you want to measure the time taken for specific commands to execute (to analyze their performance), use the Measure-Command cmdlet. This is useful for testing how long particular tasks or scripts take to run.

For example, to measure how long it takes to retrieve a list of processes:

Measure-Command { Get-Process }

4 Check network connectivity

See the status of network interfaces

PowerShell offers several cmdlets for diagnosing network connectivity, checking the status of network interfaces, and troubleshooting issues like DNS resolution and network latency.

Use the Test-Connection cmdlet to test connectivity to a specific host (e.g., a server or website) using ICMP (ping). This is useful for verifying if your system can reach another device on the network or on the internet.

The Test-NetConnection cmdlet provides a more comprehensive test of network connectivity, combining both pinging and DNS resolution.

You can use the Get-NetAdapter cmdlet to retrieve detailed information about the network adapters on your system, including their status, speed, and IP configuration. If you want to check a specific adapter (e.g., Ethernet), you can filter by name:

Get-NetAdapter -Name "Ethernet"

3 Check system event logs

Get insights into system errors

Event logs provide insights into system errors, application issues, and security concerns. You can retrieve and filter event logs with the Get-EventLog cmdlet.

To get the last 10 system events:

Get-EventLog -LogName System -Newest 10

Filter events by type (e.g., errors):

Get-EventLog -LogName Application -EntryType Error -Newest 10

2 Enter your BIOS

Without pressing keys during startup

The BIOS (Basic Input/Output System) is a key part of how a computer works, including Windows. While it doesn’t directly help with troubleshooting Windows, it’s important for diagnosing hardware and startup issues that can affect the operating system. You usually get into the BIOS by pressing a key like F2, Del, or Esc during startup.

If your computer supports UEFI, you can use PowerShell to make the system boot straight into the BIOS at the next startup. Just open PowerShell as an Administrator and run the command below. It will schedule a restart and tell the system to open the BIOS/UEFI settings when it boots up.

shutdown /r /fw

1 Find items within folders using Get-ChildItem

Particularly useful when diagnosing file system-related issues

If you’ve been using the dir command in a Command Prompt, you’re actually using an alias for Get-ChildItem. As the name implies, Get-ChildItem lists details about items within a folder, and with the -Recurse flag, it can also include items in all subfolders. It works for file system folders and other "containers" like registry keys, certificate stores, and more. This command can be extremely useful for troubleshooting in several ways, particularly when diagnosing file system-related issues or performance bottlenecks.

Use PowerShell more effectively

PowerShell is a powerful tool that can help you to automate tasks and much more. If you’re unfamiliar with it, our ultimate guide to PowerShell in Windows 11 can help. You can also explore these useful PowerShell commands and scripts to make the most of this tool.