Affiliate Disclosure: By buying the products we recommend, you help keep the lights on at MakeUseOf. Read more.
PowerShell is what you get when you give steroids to the Windows Command Prompt. It’s loaded with more power and flexibility and it grants you control of nearly every aspect of the Windows system, but it comes with one downside: a learning curve. Fortunately, PowerShell isn’t that hard to grasp.
Do you yet have to discover the benefits of PowerShell? No problem. We’ll take you through some of the most basic commands and how they can improve your Windows experience.
Even if you don’t end up using these commands from day to day, becoming familiar with them is still good since it looks like Microsoft is now more invested in PowerShell than ever before. For example, knowing PowerShell will allow you to take advantage of the awesome OneGet package manger.
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.
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 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.
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.
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.
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 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.
Again, it might seem like some of these commands aren’t very useful, but that’s because their value doesn’t shine through until you introduce some other elements that really show the power of PowerShell. For example, Get-Item is one that might seem unnecessary at first glance, but consider this:
The above essentially returns the last time someone accessed that particular directory. This kind of scripting comes in handy when you’re writing your own Cmdlets or Scripts, which is just one way to take full advantage of PowerShell’s functionality.
What do you think of PowerShell? Are you willing to learn what it offers? Share your thoughts with us in the comments below!