Top 10 Commands To Try In PowerShell

Ten Command-line Utilities to Try In PowerShell10 Command in PowerShell

The purpose of this page is to encourage you to abandon the DOS box, forget cmd.exe, and to show you how to run simple built-in utilities in PowerShell instead.

As a by-product you can brush-up your administration skills, and even learn a new command or two.

10 Useful Commands –
Try Them in PowerShell (Not DOS)

  1. Ping
  2. Get-WmiObject Win32_PingStatus
  3. Ipconfig
  4. SFC /ScanNow (System File Checker)
  5. DriverQuery
  6. TaskList and TaskKill
  7. PowerCfg
  8. BCDEdit
  9. Cacls and PowerShell
  10. Dir -v- PowerShell’s Get-ChildItem


1) Ping

Ping is still the first command I use when troubleshooting a connectivity problem.  The good news is that you can use PowerShell as a vehicle for Ping, there is no need to call for cmd.exe.  To get started search for ‘PowerShell ISE’ and when it launches, start typing the commands as you did previously.

# Ping with PowerShell
Ping localhost

Note 1: In real life you would probably start with ping router; my problem is that I can only guess at your router’s IP address, this is why used localhost in my example.

2) Get-WmiObject Win32_PingStatus

Sometimes you get lucky, PowerShell has an even better cmdlet or function than the command-line utility you used in cmd.  In this case it’s worth looking at an alternative to Ping, namely a WMI class called Win32_PingStatus.

Here is an example where you can ping a range of IP addresses, something you cannot do easily with pure ping.

# PowerShell Win32_PingStatus to ping a range of IP addresses
$i = 250
$AddrIP = "192.168.1."
Do { $IpHost = $AddrIP + $i
$Pingo = Get-WmiObject Win32_PingStatus -f "Address=’$IpHost’"
$Pingo | Format-Table Address, StatusCode -auto; $i++
until ($i -eq 255)

Note 2: With Win32_PingStatus, a result of 0 is good, it means success, the host is responding.

Challenge: Change my $i values to a range on your network; you may also need to change the value for $AddrIP.  See more on PowerShell and Win32_PingStatus.

Guy Recommends: Free WMI Monitor for PowerShellSolarwinds Free WMI Monitor for PowerShell

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft’s operating systems.  Fortunately, SolarWinds have created a Free WMI Monitor so that you can discover these gems of performance information, and thus improve your PowerShell scripts.

Take the guess work out of which WMI counters to use when scripting the operating system, Active Directory, or Exchange Server. Give this WMI monitor a try – it’s free.

Download your free copy of WMI Monitor

3) Ipconfig

This is another example where you can not only use PowerShell as a vehicle to run the command, but also enhance a well-known technique by appending a cmdlet.

# Use PowerShell to launch Ipconfig
Ipconfig | Select-String IP

Note 3: Here we combine the built-in Ipconfig command with PowerShell’s Select-String, the result is a more focussed output.

Challenge: Swap Select-String ‘Gate’ for Select-String IP. The result will be a filtered list displaying just the default router(s) address.

PowerShell and Ipconfig Find the MAC Address
In this example we want just the MAC address(s).  Observe how we can still use Ipconfig’s switches with PowerShell, just as we previously used them in a DOS box.

# Check if the MAC Address with PowerShell
Ipconfig /all | Select-String Physical

Note 4: These last two examples employ PowerShell’s signature the (|) pipe command whereby the output of Ipconfig becomes the input for Select-String.  See more on PowerShell and Ipconfig.

4) SFC /ScanNow (System File Checker)

The emphasis of this tool is on repairing critical operating system files.  By using the /ScanNow switch you can repair any critical Windows file and the corresponding registry value.  Sfc is my choice for when the operating system is behaving strangely, such as updates won’t install, or permissions seem to be scrambled.

You can run sfc.exe as easily in PowerShell as DOS.  While PowerShell has the edge if you need to output the results to a file, or merely copy the results to the clipboard; my objective is to give you one more reason to forget about cmd.exe and always use PowerShell.

# PowerShell SFC Result
Windows Resource Protection did not find any integrity violations.

Guy Recommends:  A Free Trial of the Network Performance Monitor (NPM)Review of Orion NPM v11.5 v11.5

SolarWinds’ Network Performance Monitor will help you discover what’s happening on your network.  This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.

What I like best is the way NPM suggests solutions to network problems.  Its also has the ability to monitor the health of individual VMware virtual machines.  If you are interested in troubleshooting, and creating network maps, then I recommend that you try NPM now.

Download a free trial of Solarwinds’ Network Performance Monitor

5) DriverQuery

Another useful utility from the Windows\System32 folder is DriverQuery.  It’s worth a place in your toolkit for troubleshooting driver problems. 

# Check the Drivers
DriverQuery -si

Once again PowerShell adds value, for example, you can filter with Select-String, and thus list only unsigned drivers, IsSigned False.

# Check For Unsigned Drivers
DriverQuery -si | Select-String False

See my function Get-Driver »

6) TaskList and TaskKill

You can execute these two programs in PowerShell just as you would in the cmd DOS box.  The benefit is that you may be tempted to switch to PowerShell’s native Get-Process.  Once you have checked the list of ‘Tasks’ you can pipe a specific item to Stop-Process.

# Migrate from TaskList and TaskKill to Get-Process

# Get-Process abc | Stop Process -force

Get-Process offers so much more control than TaskList, for example you can sort, filter and select columns.  See more on PowerShell and Get-Process.

7) PowerCfg

While PowerShell does not add much value here, this is a reminder that PowerCfg is an interesting utility, and valuable for troubleshooting computer hibernation problems.

# PowerShell and PowerCfg Troubleshoot Sleep Problems

Note 5: For more ideas try the command’s own help:
Powercfg /?

See more on Windows 8 Powercfg /Energy »

8) BCDEdit

BCDEdit is a very difficult and specialist program to check or amend the bootloader.  You would do this if you wanted an alternative to MSConfig when altering dual boot settings.  If you are going to use this utility then by now you may be more confident of handling it PowerShell than in DOS.  See more on Windows 8 and BCDEdit.

SolarWinds Response Time Viewer for WiresharkGuy Recommends: Response Time Viewer for Wireshark

Here is a free tool to troubleshoot network connection and latency problems.  Key concept: this is a free tool from SolarWinds that analyzes network packets captured by Wireshark (also a free tool).

When you inspect the data in the Response Time Dashboard, if you hover over an application such as Teredo or TCP, then you get an orange box showing a breakdown of network and application response times, note the 'Peak value' in addition to the 'Average'.

Download your free trial of SolarWinds Response Time Viewer for Wireshark

9) Cacls and PowerShellPowerShell Runs Cacls

My thinking here is if you wish to experiment with file and folder permissions then PowerShell offers an easier way of storing the commands than using a batch file. 

Once you have run a command in PowerShell, especially the ISE version, it’s a trivial task to save the ‘script’ for re-use.  Click on the ‘File’ menu just as you would any other program.  See screenshot to the right.

10) Dir -v- PowerShell’s Get-ChildItem

As with many of these 10 commands to try in PowerShell, I like to have more than one objective.

a) PowerShell provides aliases so that you can run your old commands such as DIR until you master PowerShell’s equivalent Get-ChildItem.

b) PowerShell adds value, for instance, the ability to sort.  Incidentally, you can search subdirectories by appending -recurse.

c) I wanted to leave you with a method for researching your own list of built-in executables to run in PowerShell.

# List Your Own Commands to Try in PowerShell
Dir C:\Windows\System32\*.exe | Sort-Object Name

For example, you could try WhoAmI /all, also research Cacls, NetSh, RoboCopy or Shutdown.

For more ideas for top 10 administrative commands see here »

Summary of Top 10 Commands to Try in PowerShell

My mission is to persuade you to switch from cmd.exe to PowerShell.  I have tried to make the journey interesting by selecting utilities that valuable in troubleshooting common Windows problems.  I also want to show that in many cases PowerShell can actually enhance the underlying utility compared with running it in a DOS box.

If you like this page then please share it with your friends


See more Microsoft PowerShell tutorials

PowerShell Tutorials  • Methods  • Cmdlets  • PS Snapin  • Profile.ps1  • Exchange 2007

Command & Expression Mode  • PowerShell pipeline (|)  • PowerShell ‘where‘  • PowerShell ‘Sort’

Windows PowerShell Modules  • Import-Module  • PowerShell Module Directory 

If you see an error of any kind, do let me know.  Please report any factual mistakes, grammatical errors or broken links.