Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 34 ยท Getting Started

What Is PowerShell?

Learn what PowerShell is, how it differs from classic shells, why it passes objects instead of text, and how Windows PowerShell 5.1 differs from PowerShell 7.

PowerShell is two things at once: a command shell you type into, and a scripting language you save in files. You use it to inspect a computer, change settings, move files, call web services and automate the boring parts of a job. If you have used Command Prompt or a Linux terminal, the idea is familiar. What makes PowerShell different is what flows between commands. Classic shells pass text. PowerShell passes objects: structured things with named properties and actions.

This lesson gives you the big picture before any real commands: what PowerShell is, which version to use, where it runs, and why objects change the way you write one-liners. The commands in this tutorial are real PowerShell, but the site cannot run PowerShell itself. So every lesson shows the real commands in read-only blocks and then lets you play with a small JavaScript stand-in that models the same idea. The lessons always say which is which.

Shell versus scripting language

A shell is a program that reads what you type, runs it and prints the result. A scripting language lets you write programs: variables, conditions, loops and functions. Most shells have grown into both. PowerShell was designed as both from the start, so the line you type at the prompt is already valid code you can paste into a script.

POWERSHELL
# One line at the prompt...
Get-Process | Where-Object CPU -gt 100 | Sort-Object CPU -Descending

# ...is the same language you use inside a script or function.
foreach ($name in 'notepad', 'code') {
    Write-Output "Checking $name"
}

Because there is only one language, there is no jump from "typing commands" to "writing real programs". You start with one-liners and grow them.

PowerShell in one picture

A shell Type a command, get a result.
A language Variables, loops, functions, modules.
Objects Commands exchange structured data.

One tool covers the prompt and the script file.

1 / 2

Two families: Windows PowerShell 5.1 and PowerShell 7

You will meet two products with almost the same name.

Windows PowerShell PowerShell 7
Version 5.1 (final) 7.x, updated regularly
Program name powershell.exe pwsh (pwsh.exe on Windows)
Built on .NET Framework modern .NET
Runs on Windows only Windows, Linux and macOS
Installed Included with Windows Separate install, side by side
New features Security fixes only Yes

Windows PowerShell 5.1 is the one already on a Windows machine. It still receives fixes, but no new language features. PowerShell 7 is the actively developed edition: it is cross-platform, faster in many cases and has newer syntax such as the ternary operator and &&/|| pipeline chains. Installing PowerShell 7 does not remove 5.1; the two live next to each other and you pick one by the program you start.

You can always ask a session which one it is:

POWERSHELL
$PSVersionTable.PSVersion
$PSVersionTable.PSEdition   # "Desktop" for 5.1, "Core" for 7

This tutorial targets PowerShell 7 and points out places where 5.1 behaves differently. Most of the core ideas (cmdlets, objects, the pipeline) are identical in both. Some old Windows-only modules, for example parts of the classic Active Directory or Windows management tooling, were written for 5.1, and when you need one of them you simply start powershell.exe instead.

"PowerShell Core" was the name used for the early cross-platform 6.x releases. Today you just say "PowerShell 7". The PSEdition value Core is a leftover from that name.

Where PowerShell runs and what it manages

On Windows you can manage files, services, the registry, scheduled tasks and event logs. On Linux and macOS PowerShell works with files, processes, text and the network, and calls native programs such as git or docker like any other shell. PowerShell is also the standard way to manage Microsoft 365 and Azure through modules, and it can control remote machines over SSH or WinRM (you will meet remoting in a later lesson).

Anything with a .NET API is within reach. That is a big reason PowerShell is popular for administration: when no ready-made command exists, you can call the .NET library directly from the prompt.

Objects instead of text

Run ls in a Unix shell and you get lines of text. If you want only the size column of the biggest file, you cut, sort and parse that text by position. It works until a file name contains a space or the column layout changes.

PowerShell commands, called cmdlets, return objects. An object carries its data as named properties (such as Name, Length, LastWriteTime) and its actions as methods. What you see on screen is only a table that PowerShell draws from those objects at the very end. In between, the objects travel intact.

POWERSHELL
Get-ChildItem | Sort-Object Length -Descending | Select-Object -First 3 Name, Length

There is no text parsing here. Sort-Object asks for the Length property and Select-Object picks the Name and Length properties. The next lesson set, starting with Objects, Properties and Methods, digs into this.

Try it: text versus objects

The real PowerShell is not available here, so this stand-in uses JavaScript. It models the same data twice. First as a text table you must parse by column positions, then as objects you query by property name. The "files" are made up.

JS Stand-in: parsing text versus using objects

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Notice that the text version needed a guess ("two or more spaces separate columns") and still left the size as a string. The object version never lost the number's type. That is the whole advantage in miniature.

Seeing the same idea as a pipeline

A pipeline connects commands with the | character. Each command receives the objects the previous one produced. Here is a second stand-in. It builds a tiny pipeline from three functions and prints what each stage passes along, so you can see objects (not text) moving through.

JS Stand-in: a three-stage pipeline of objects

Press Run (or Ctrl + Enter) to see the console output here.

No output.

What is real and what is the stand-in: the commands in the powershell blocks are genuine PowerShell and you can try them on your own computer. The JavaScript only imitates the shape of the data flow. Real PowerShell streams objects one at a time, which the pipeline lesson shows in detail.

Why learn it

  • One language, prompt to program. Short commands scale up into scripts.
  • Consistent names. Commands follow a Verb-Noun pattern, so you can guess them.
  • Built-in discovery. You can ask any command what it accepts and what it returns.
  • Reach. Windows administration, cloud services and plain files are all handled with the same skills.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is the main difference between PowerShell and a classic text-based shell?

    Cmdlets output .NET objects with properties and methods. Text is only produced at the end, when PowerShell formats the objects for display.
  2. 2. Which program starts PowerShell 7?

    PowerShell 7 starts with pwsh. powershell.exe is Windows PowerShell 5.1, which is a separate program that stays installed side by side.
  3. 3. Which statement about Windows PowerShell 5.1 is true?

    5.1 is the Windows-only edition built on .NET Framework. It gets only fixes, and installing PowerShell 7 leaves it in place.
  4. 4. Which expression tells you the edition of the current session?

    $PSVersionTable is an automatic variable holding version details. PSEdition is Desktop for Windows PowerShell and Core for PowerShell 7.

Summary

  • PowerShell is both an interactive shell and a scripting language.
  • Windows PowerShell 5.1 (powershell.exe) ships with Windows; PowerShell 7 (pwsh) is cross-platform and actively developed. They can be installed side by side.
  • Cmdlets return objects with properties and methods, so you select and sort by name instead of parsing text.
  • Check your session with $PSVersionTable.
  • On this site the real commands are read-only, and JavaScript stand-ins model how the ideas work.

Next: Installing and Your First Commands.