PowerShell is more than just a command line shell. It is a configuration management framework that the command line shell is part of, but also a scripting language.
It is more powerful than the Windows command prompt but also more intimidating. While it has been there for more than a decade, most Windows users are probably not very familiar with PowerShell.
This guide provides you with information on learning PowerShell, by using PowerShell. This may sound confusing at first, but it is not really. What I try to do here is to give you commands at hand that help you understand PowerShell commands.
Please note that this is not a complete PowerShell tutorial that teaches you all there is to know about it. It is designed to give you tools at hand that you can use whenever you stumble upon PowerShell commands, or want to do something using PowerShell but don't know how to.
It all begins by starting a new PowerShell command line shell.
Note: Some commands, the updating of help files for instance, may require elevation.
The command Get-Command lists all PowerShell Cmdlets when you run it. This may not look super useful right away.
If you use Get-Command | Format-List * instead, you get a formatted listing instead that lists, among other things, the help file URI of each command.
If you want all those help file links, use Get-Command | Get-Help | Out-File c:\ps\help.txt. This gets all help topics of all cmdlets, and saves them to the help.txt file on c:\ps.
You may also filter the listing, by using a command such as Get-Command *process. This lists all commands with process in their name (meaning all that manipulate processes).
First thing you may want to do is update the help file. Not all help topics are available by default, and running the command ensures that they are up to date and available locally.
Run Update-Help, and wait for the process to finish.
Want to force updates and all? run the command update-help -Module * -Force instead.
As far as help commands are concerned, the main one is get-help "cmdlet", e.g. get-help get-command to display information about get-command. Running get-help displays the following for the selected command.
You may also display the help of a cmdlet by appending -? to its command, e.g. Update-Help -?.
The command get-help -detailed displays detailed information about the command. Please note that the command does not work on all cmdlets.
The command get-help "command" -full lists all information that is available. This includes examples, notes, inputs and outputs, and more on the screen.
You may display the online version of help for a command by using the -online parameter, e.g. Get-Help Format-List -Online.
The command Get-Help * on the other hand lists all help topics that are available.
To get help about parameters, use the command Get-Help "command" -Parameter "Name", e.g. Get-Help Format-List -Parameter GroupBy.
Last but not least, you may use Get-Help "word" to list topics that include the word you have specified, e.g. Get-Help process.
Sometimes, all you need is an example to find out more about a cmdlet. You can use the command get-help "cmdlet" -examples, e.g, get-help write-verbose -examples, to list examples that reveal how the cmdlet is used.
To display help content in a new window instead of the one you run the command in, use get-help "command" -ShowWindow, e.g. get-help write-verbose -ShowWindow.
Aliases help you type commands faster. The best way to know about aliases is to run get-alias. The command lists them all in the interface.
The following online resources are excellent when it comes to learning more about PowerShell:
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats (video ads) or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.