TExcelTAD
Home › PowerShell › PowerShell Intro

PowerShell Intro

PowerShell is a command-line shell and a scripting language from Microsoft. You can type commands into it one at a time, like in any terminal, or save them in a .ps1 script file and run them as a program. It is used every day by system administrators, DevOps engineers and developers to automate repetitive work: creating user accounts, cleaning up log folders, deploying applications, reading reports, or talking to cloud services such as Azure and AWS.

powershell · try it yourself
Write-Output "Hello from PowerShell!"
"PowerShell can do maths too: $(6 * 7)"
Hello from PowerShell!
PowerShell can do maths too: 42

The first line calls a cmdlet (pronounced "command-let") called Write-Output. The second line is just a string: PowerShell prints any value that you leave on its own line. $( … ) inside double quotes runs a small piece of code and inserts the result.

What makes PowerShell different

Most classic shells such as Bash or the Windows Command Prompt pass text from one command to the next. PowerShell passes .NET objects. An object has named properties (data) and methods (actions), so you never need to cut columns out of text with tools like awk or cut. You just ask for the property you want.

powershell · try it yourself
$today = Get-Date -Date '2026-03-14'
$today.Year
$today.DayOfWeek
$today.AddDays(30).ToString('yyyy-MM-dd')
2026
Saturday
2026-04-13

Get-Date returned a DateTime object. We read its Year and DayOfWeek properties and called its AddDays() method, with no text parsing at all.

Feature Classic text shells PowerShell
What flows through the pipe Lines of text Objects with properties
Command names Short and varied (ls, grep, ps) Consistent Verb-Noun (Get-ChildItem)
Help man pages Get-Help, built into every command
Platform Mostly one OS family Windows, Linux and macOS
Language Shell syntax Full language: functions, classes, try/catch

Windows PowerShell 5.1 vs PowerShell 7

There are two products with almost the same name, and it is important not to mix them up:

Windows PowerShell 5.1 PowerShell 7.x
Program name powershell.exe pwsh / pwsh.exe
Runs on Windows only Windows, Linux, macOS
Built on .NET Framework 4.x Modern .NET (8, 9, 10…)
Status Ships with Windows, receives only security fixes Actively developed, open source on GitHub
New features None Ternary ? :, ??, &&/`

Both can be installed side by side on the same Windows computer. This course teaches PowerShell 7, and every runnable example was checked with PowerShell 7.6 on Linux. Almost everything also works in Windows PowerShell 5.1; lessons point out the exceptions.

powershell · try it yourself
$PSVersionTable.PSVersion.Major
$PSVersionTable.PSEdition
$IsLinux
7
Core
True

$PSVersionTable is a built-in variable describing the running shell. PSEdition is Core for PowerShell 7 and Desktop for Windows PowerShell 5.1. The automatic variables $IsWindows, $IsLinux and $IsMacOS (PowerShell 7 only) tell your script which operating system it runs on.

How the examples on this site work

PowerShell can't run inside a web browser, so the playgrounds on this site are simulated: when you press Run, you see the output that the code produced when it was verified with the real PowerShell 7.6. To experiment freely, install PowerShell (next lesson) and paste the examples into your own terminal.

Some PowerShell features only exist on Windows: the registry, Windows services, WMI/CIM, Active Directory and C:\ paths. Those are shown in normal (non-runnable) code blocks with a labelled sample of what Windows prints.

Tip: PowerShell is case-insensitive for command names, parameters, variables and most string comparisons. get-date, GET-DATE and Get-Date are the same command, but the convention is to write them in PascalCase.

Test yourself

What does the PowerShell pipeline pass from one command to the next?

  1. Plain text lines
  2. .NET objects
  3. Only numbers
  4. Files on disk

Which program starts PowerShell 7?

  1. powershell.exe
  2. cmd.exe
  3. pwsh
  4. bash

What is $PSVersionTable.PSEdition in PowerShell 7?

  1. Desktop
  2. Core
  3. Windows
  4. Seven