6 Basic PowerShell Commands to Get More out of Windows

6 Basic PowerShell Commands to Get More out of Windows


Get-Help

Microsoft is aware of PowerShell’s learning curve. That’s why it comes with the aptly-named cmdlet Get-Help, which provides you with all of the information you’d need to properly run the commands available to you. Get used to relying on this whenever you get stuck or confused.

Get Help

Typing Get-Help into PowerShell gives a brief description of what it does and how to use it. Here are some tips to get you started.


Get-Help <command> gives a rundown of that particular command, which includes a description, related commands, and syntax rules when using the command. When viewing syntax rules, elements in square brackets [] are optional.

Get-Help <command> -Full gives a detailed rundown of that particular command.

Get-Help <command> -Example shows several examples of how the command can be used and what sort of output you can expect.

Get-Help * lists every possible help topic that’s available to you. It might overwhelm you at first so it’s not recommended if you’re brand new to PowerShell (this would be similar to reading through a dictionary cover to cover). Use it as a reference when you’re more comfortable.


Get-Command

Get-Command lists out all of the commands that are currently available to you right now. Put another way, it does not list out every single command available in PowerShell. Even so, this list can get to be pretty long, so it’s best that you filter it according to what you’re looking for.

Get-Command -Name <name> shows commands with the given name. If you don’t know the exact name, you can use it in conjunction with a wildcard (*) like so: Get-Command -Name *register*, which would return all commands that have “register” somewhere in the name.

Get-Command -CommandType <type> only shows commands of a particular type: Alias, Cmdlet, Function, or Script. Understanding the difference between these types is beyond the scope of this article.

Get-Item

The Get-Item cmdlet returns the item specified by the parameters you give. This item could be a file, folder, script, or whatever. Do note that it doesn’t return the contents of the item, so if you used Get-Item on a .TXT file, it wouldn’t show you the actual text within.


Using Get-Item on a directory will return the actual directory, not the items within that directory. If you want to do the latter, you must use the Get-ChildItem cmdlet instead.

The opposite of Get-Item is the Remove-Item cmdlet, which deletes the specified item.

Get-Content

This cmdlet is like Get-Item above, except it actually returns the contents of the specified item. If you used Get-Content on a .TXT file, it would return all of the text inside. If you used it on a .PNG file, you’d get a bunch of nonsensical and unreadable binary data.

On its own, this cmdlet isn’t too useful. However, you can combine it with more advanced cmdlets (which we won’t cover here due to it being beyond our scope) to neat effect.


An example: using Get-Content on a .TXT file full of different web addresses and feeding that info to a Foreach-Object cmdlet to perform a command using each web address as a parameter.

Get-Service

As its name states, the Get-Service cmdlet allows you to retrieve information on the services that are installed on your computer. Running it without any parameters will show a list of all services along with their statuses (e.g. Running or Stopped).

If you know exactly what you’re looking for, using Get-Service can be a lot faster than navigating through Windows Control Panel and dealing with services through the GUI.

Other useful service-based cmdlets include Start-Service, Stop-Service, Suspend-Service, Resume-Service, and Restart-Service.

Get-Process

Get-Process is similar to Get-Service except it returns information on processes. On its own, the command will list all of the currently running processes on your system. Processes can be filtered according to names and IDs among other identifiers.

Other useful cmdlets include Start-Process, Stop-Process, and Wait-Process. Once you get comfortable with these, you’ll have an easier time debugging process-related hiccups on your system than if you were to use the Windows Task Manager.


    • Related Articles

    • How to perform a clean boot in Windows

      How to perform a clean boot in Windows https://support.microsoft.com/en-us/help/929135/how-to-perform-a-clean-boot-in-windows Summary A clean boot is performed to start Windows by using a minimal set of drivers and startup programs. This helps ...
    • Essential Windows CMD Commands You Should Know

      https://www.makeuseof.com/tag/essential-windows-cmd-commands/ A–B ASSOC - Displays or modifies file extension associations. ATTRIB - Displays or changes file attributes. BREAK - Sets or clears extended CTRL+C checking. BCDBOOT - Used to copy critical ...
    • WINDOWS 15 CMD Commands Every Windows User Should Know

      https://www.makeuseof.com/tag/15-cmd-commands-every-windows-user-know/ Our 15 Favorites 1. ASSOC Most files in Windows are associated with a specific program that is assigned to open the file by default. At times, remembering these associations can ...
    • 3 Clever PowerShell Functions After Upgrading to Windows 10

      https://www.makeuseof.com/tag/3-clever-powershell-functions-upgrading-windows-10/ Uninstall Pre-Installed Apps One of the bigger news points (out of many) for Windows 10 was the announcement of a built-in package manager. PackageManagement, formerly ...
    • Basic Printer Troubleshooting

      Basic Printer Troubleshooting Introduction This document will provide the simple troubleshooting steps when you have encountered a printing problem to your printer. Basic Printer Troubleshooting When you are having problems printing, you would have ...