Introduction to PowerShell
Once you open PowerShell from the Start menu, a window like the one below should appear.

The application we need to open is Windows PowerShell.
Windows PowerShell ISE, short for Windows PowerShell Integrated Scripting Environment, provides a graphical user interface (GUI) tailored for PowerShell. This interface allows you to write, execute, test, and debug commands all within a single window.
Your First Command
After opening PowerShell, the first line we'll write will be to check the version of PowerShell.
PS C:\Users\user> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.19041.1237
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1237
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1Getting Help
There are thousands of commands in PowerShell, and memorizing all of them can be nearly impossible unless you have an exceptional memory.
In fact, there's no need to memorize commands. That's what help pages are for.
In PowerShell, commands are referred to as "cmdlets." Cmdlets are named in a "Verb-Noun" format.
For example,
Get-Processcmdlet is used to view processes, while Get-Service cmdlet is used for information about services.
The term PowerShell command is often used as a general term for any type of command in PowerShell, regardless of whether it is a cmdlet, function, or alias.
Get-Help Command
The Get-Help command is used to get information about a command. To learn how the Get-Help command works, you can write:
Get-Help Get-HelpIf the output is too long, you can access the help page by appending -? to any command.
Get-Command
But what if we forget the name of the command we need help with?
That's where Get-Command comes to the rescue. Get-Command is a command used to list all commands, cmdlets, functions, filters, scripts, and even application commands that are installed in PowerShell.
To see the usage of this command, you can use get-help again.
Get-Help -Name Get-Command -DetailedThese two commands actually cover about 80% of what you need to know to learn PS.
Update-Help
If the help pages are missing or outdated, you can use the Update-Help command to update them.
This command requires elevated privileges.
Aliases
Aliases are special names in PowerShell that are used to create shortcuts for cmdlets, functions, and scripts. They help you work faster by making commands shorter and easier to write.
If you are already familiar with Linux or CMD commands, this will be very useful to you.
For example, the alias cd can be used for the Set-Location cmdlet.
It is recommended to know aliases for faster PowerShell usage.
To view all aliases:
aliasTo view the alias for a specific command, you can write the command after
alias:
PS C:\Users\user> alias cd
CommandType Name Version Source
----------- ---- ------- ------
Alias cd -> Set-LocationTab Completion
PowerShell tab completion is a feature that automatically completes a command or parameter name when you press the Tab key. This feature helps you write commands and parameters faster and more easily.
To use tab completion:
Start typing the name of a command or parameter.
Press the Tab key.
PowerShell will automatically complete the most appropriate match for what you've typed. If there are multiple matches, pressing the Tab key again will cycle through the available options.
This is a feature you will use frequently for efficient and effective PowerShell use.
For example, in the home directory (
C:\Users\<USERNAME>):
Set-Location do<TAB>The first suggestion will be
.\Documents\, and pressing the Tab key again will suggest.\Downloads\.
Last updated