Loading
All articles
Programming 18 min read

What Is PowerShell? A Simple Guide to the Windows Command Line That Speaks in Objects

A friendly, jargon-free guide to PowerShell, the command line built into every Windows PC. Learn its Verb-Noun commands, see why it passes objects instead of plain text, rename 1,000 photos in under a second and find out why there are two PowerShells.

nbkhope
On this page

If you use Windows, PowerShell is already on your computer. Right-click the Start button and choose Terminal, and the blue-and-black window that opens is, by default, running PowerShell. Most people never touch it. The people who keep schools, hospitals and offices running often use it every day.

PowerShell is Microsoft's shell: a program that lets you control a computer by typing commands instead of clicking. It's also a scripting language for automating chores, and it has one big idea that makes it different from older shells. This article explains, in plain language, what PowerShell is, how it works and why so many IT people swear by it.

What is PowerShell?

A shell is a go-between: you type a request in words, it figures out what you mean, gets the computer to do it and shows you the answer. Windows has had one since the 1980s, the Command Prompt, which descends from the DOS prompt. It worked, but it was limited. To manage a Windows computer seriously, you mostly had to click through settings windows, one computer at a time.

PowerShell, released in 2006, was Microsoft's answer. Its goal was simple to say: anything you can do by clicking in Windows, you should be able to do by typing, and then repeat on a thousand computers.

A first conversation with PowerShell

Here is a real session. We typed these commands into PowerShell 7.6, as a user named maria, in a folder of vacation photos, and copied the answers exactly. We ran it on Linux, which is why the folder is called /home/maria. On Windows it would be C:\Users\maria:

A first conversation with PowerShell, using real commands and their real answers, typed into PowerShell 7.6 running on Linux. 1, Get-Location answers with the path /home/maria. 2, Set-Location vacation goes into the folder. 3, Get-ChildItem lists what is here, as a table with columns for the mode, user, group, last write time, size and name: beach.jpg, 3,284,512 bytes; family.jpg, 4,118,203; notes.txt, 1,204; and sunset.jpg, 2,471,936. 4, Get-ChildItem *.jpg piped to Measure-Object Length -Sum counts the photos and adds up their sizes: Count 3, Sum 9,874,651. 5, "Hello, $env:USER" answers Hello, maria. 6, typing 365 * 24 answers 8760, the hours in a year. 7, (Get-Date '2026-08-12').DayOfWeek answers Wednesday. 8, $PSVersionTable.PSVersion answers with a table: major 7, minor 6, patch 6. PowerShell answers with neat tables and lists. On Windows, the same commands work

A few things to notice:

  • The prompt starts with PS, followed by the folder you're in and a >. That's PowerShell saying "go ahead".
  • The answers come back as tidy tables and lists, with column headings, not just loose lines of text.
  • You can type math directly. 365 * 24 answers 8760, no extra command needed.
  • Words starting with $ are variables. $env:USER reads your user name from the system (on Windows it's called $env:USERNAME).

Commands with names you can guess

Older shells have short, cryptic command names like ls and grep. PowerShell went the other way. Every built-in command, called a cmdlet (say "command-let"), is named Verb-Noun: what to do, then what to do it to.

Anatomy of a PowerShell command, Get-ChildItem -Path vacation -Filter *.jpg. Get is the verb: what to do. ChildItem is the noun: what to do it to, the items inside a folder. -Path vacation is a parameter: which folder. -Filter *.jpg is a parameter: only the .jpg files. Every command is named Verb-Noun, so you can often guess them: Get-Date, what time is it? Get-Process, which programs are running? Stop-Process, close a program. Copy-Item, copy a file or folder. Remove-Item, delete a file or folder. Get-Help, explain any command. Old habits work too. Real aliases, or nicknames, in PowerShell on Windows: dir, ls and gci all run Get-ChildItem; cd runs Set-Location; cat runs Get-Content; copy runs Copy-Item; del runs Remove-Item. Tab also finishes long names: type Get-Chi and press Tab

The names are long, but they read almost like English, and they're predictable. If Get-Process lists the programs that are running, it's a good bet that Stop-Process stops one. Settings beginning with a dash, like -Path and -Filter, are called parameters, and they have readable names too.

You don't actually have to type all of that. Press Tab and PowerShell finishes the name for you. And for people coming from other shells, PowerShell has aliases, short nicknames: dir (from the old Command Prompt) and ls (from Bash) both run Get-ChildItem.

Stuck? Two commands help you explore: Get-Command lists the commands that exist, and Get-Help explains any of them.

Get-Command -Noun Process      # every command that works with programs
Get-Help Get-ChildItem         # what Get-ChildItem does and its parameters

The big idea: objects, not just text

This is what makes PowerShell special. In most shells, like Bash, commands talk to each other in plain text. One program prints lines of words, and the next program has to pick those words apart.

PowerShell commands pass objects instead. An object is like a filled-in form: every piece of information sits in its own labeled box. Here's the same photo described both ways, real output from the same file:

The big idea: PowerShell passes objects, not just text. The same photo, as Bash and PowerShell describe it, real output for the same file. Bash gives one line of text: -rw-r--r-- 1 maria maria 3284512 Jul 4 10:12 beach.jpg. To get the size, the next program has to count the words in the line and hope the 5th one is the size. PowerShell gives an object with labeled properties: Name, beach.jpg; Extension, .jpg; Length, 3284512; LastWriteTime, 07/04/2026 10:12:00; and 31 more, 35 in all. The next command just asks for .Length: (Get-Item beach.jpg).Length answers 3284512. No counting, no guessing, and it is a real number you can sort and add up

With text, getting the size means counting words in a line and hoping the layout never changes. With an object, you just ask for the box labeled Length. Our photo's object had 35 labeled properties in all: its name, size, dates, folder, permissions and more.

Files aren't the only objects. Running programs, dates, users, network adapters, services and printers all come out of PowerShell commands as objects. That's why one small set of commands can work with all of them.

Asking questions with the pipeline

Like other shells, PowerShell connects commands with the | symbol, called a pipe. The difference is that what flows through the pipe is objects. That turns a handful of general commands into a way to ask questions about anything:

Asking questions about the photos, one object pipeline at a time, real output from PowerShell 7.6. 1, Get-ChildItem piped to Sort-Object Length -Descending piped to Select-Object Name, Length shows the biggest file first with only the name and size: family.jpg 4118203, beach.jpg 3284512, sunset.jpg 2471936, notes.txt 1204. 2, Get-ChildItem piped to Where-Object Length -gt 3MB shows only files bigger than 3 MB: beach.jpg and family.jpg. 3, adding Select-Object -First 1 -ExpandProperty Name gives just the name of the biggest one: family.jpg. 4, (Get-Item beach.jpg).Length / 1MB gives the size of one photo in megabytes: 3.13235473632812. Sort-Object, Where-Object and Select-Object work on any kind of object, so the same few commands sort files, programs or emails. 1MB is PowerShell shorthand for 1,048,576 bytes
  • Sort-Object puts things in order by any property: size, date, name.
  • Where-Object keeps only the things that match a condition, like "bigger than 3 MB". -gt means "greater than".
  • Select-Object picks which properties to show, or how many items.

Swap Get-ChildItem for Get-Process and the very same commands answer questions like "which five programs are using the most memory?"

Get is the most common verb

To see how the Verb-Noun idea plays out, we counted the 257 cmdlets that come built into PowerShell 7.6 and grouped them by their verb:

Get is by far the most common verb. The 257 built-in cmdlets of PowerShell 7.6, grouped by the verb at the start of their names: Get 56, Set 18, New 18, Remove 12, Write 8, Import 8, Update 7, ConvertFrom 6, ConvertTo 6, Export 6, Invoke 6, Start 5. 257 built-in cmdlets, 60 different verbs used, and 100 approved verbs to choose from, listed by Get-Verb. Microsoft keeps an official list of approved verbs, so everyone writes Remove instead of Delete, Erase or Kill. Get only reads things, which makes it safe to explore: a Get command never changes anything

More than one in five starts with Get, and that's good news for beginners: Get commands only read information, they never change anything. Microsoft also keeps an official list of 100 approved verbs (type Get-Verb to see it), so that commands from different companies feel the same. Everyone writes Remove, not Delete, Erase or Kill.

Why type when you can click?

The real payoff of any shell is doing the same thing many times. Imagine a camera named 1,000 vacation photos IMG_0001.jpg to IMG_1000.jpg, and you want them called beach-trip-0001.jpg and so on. We tried it on a Windows 11 PC:

Rename 1,000 photos: clicking vs one line of PowerShell, on a Windows 11 PC. Turn IMG_0001.jpg through IMG_1000.jpg into beach-trip-0001.jpg through beach-trip-1000.jpg. By hand: about 83 minutes, if each file takes 5 seconds: click, F2, type, Enter. PowerShell: under 1 second, measured. The one line is: Get-ChildItem IMG_*.jpg piped to Rename-Item -NewName, with a block that takes the name, $.Name, and replaces IMG at the start with beach-trip-. Measured on Windows 11 with Measure-Command, three runs each: 0.72 to 0.86 seconds in PowerShell 7.6 and 0.66 to 0.67 seconds in Windows PowerShell 5.1. The 5 seconds per file by hand is an estimate

Read it left to right: get every file named like IMG_*.jpg, then rename each one. Inside the curly braces, $_ means "the current file", so $_.Name -replace '^IMG_', 'beach-trip-' takes each file's name and swaps the IMG_ at the start for beach-trip-. PowerShell's built-in Measure-Command timed it: under a second, in both the old and the new PowerShell.

Before running something that changes many files, there's a lovely safety feature. Add -WhatIf to most commands that change things, and PowerShell only tells you what it would do. This is real output:

PS /home/maria/vacation> Remove-Item *.txt -WhatIf
What if: Performing the operation "Remove File" on target "/home/maria/vacation/notes.txt".

Nothing was deleted. Remove the -WhatIf when you're happy with the plan.

Scripts: recipes saved in a file

Commands you use often can be saved in a file ending in .ps1, a PowerShell script. Here's a small one that backs up the vacation photos, and what happened when we ran it:

A PowerShell script is a recipe of commands saved in a .ps1 file, called backup.ps1. Line 1 is a comment, a note for humans only. Lines 2 to 4 are a param block, the settings the script accepts: a destination, with a default of the backup folder in your home folder. Line 5 makes the folder, and Out-Null hides the reply. Line 6 is a variable holding the photo objects from the vacation folder. Lines 7 to 9 are a loop: for every photo, copy it. Lines 10 to 15 are a decision: if there are 0 photos, say "No photos found.", otherwise add up their sizes and say how many photos were copied, how many megabytes, and where. Running it, for real: ./backup.ps1 answered "Copied 3 photos (9.4 MB) to /home/maria/backup". ./backup.ps1 -Destination /home/maria/usb answered "Copied 3 photos (9.4 MB) to /home/maria/usb". The param block turns the script into a command of its own, with its own -Destination parameter. We also emptied the folder and ran it again: it answered "No photos found."

The script uses the classic building blocks of programming: variables ($photos), a loop (foreach) and a decision (if and else). Because the photos are objects, adding up their sizes takes one line. And the param block gives the script its own -Destination parameter, so it works just like a built-in command.

On Windows, you may hit a surprise the first time you run a script:

backup.ps1 cannot be loaded because running scripts is disabled on this system.

That's PowerShell's execution policy, a safety net. Because a script can do anything you can do, Windows is cautious with them: depending on the version and settings, it blocks scripts entirely or only allows downloaded scripts that are digitally signed. Microsoft itself describes it as a guard against running scripts by accident, not a strong lock. Only change it if you understand where your scripts come from.

What people use it for

  • Managing many computers at once. IT teams use PowerShell to set up new PCs, install updates and check settings on hundreds or thousands of machines, often remotely with Invoke-Command.
  • Microsoft's cloud. Microsoft 365, Exchange email and Azure can all be managed with PowerShell. Adding 500 new students' email accounts is a short script instead of a week of clicking.
  • Everyday chores. Renaming files, cleaning up old downloads, checking which programs start with Windows, or making a report of disk space.
  • Developers. Build scripts, test runs and setup steps, especially on Windows.

In the 2025 Stack Overflow Developer Survey, 23.2% of developers who answered said they had worked with PowerShell in the past year. That's about the same as C++, and about half as many as Bash and other Unix shells (48.7%), which dominate on Linux servers.

Two PowerShells: which one do I have?

This confuses almost everyone, so here it is plainly. There are two PowerShells, and they can live side by side:

Two PowerShells: which one do I have? Windows PowerShell, version 5.1, comes with every copy of Windows 10 and 11, runs on Windows only, is called powershell.exe, is built on the .NET Framework, is not open source, and has had no new features since 2016, only fixes. PowerShell, version 7 and later, is a free download from Microsoft, runs on Windows, Mac and Linux, is called pwsh.exe (pwsh on Mac and Linux), is built on modern .NET, has been open source on GitHub since 2016, and gets a new version every year or so. Most commands work the same in both. Microsoft recommends PowerShell 7 for new work, while Windows PowerShell 5.1 stays in Windows for older scripts that need it

To check, type $PSVersionTable.PSVersion. If it says 5.1, you're using the one built into Windows. If it says 7 or more, you're using the modern one.

PowerShell keeps growing

We downloaded six releases of modern PowerShell from Microsoft's official GitHub page and counted the cmdlets built into each one, in a clean Linux container with nothing else installed:

PowerShell keeps growing. Built-in cmdlets in each release, counted in a clean Linux container: 6.0 from 2018, 208; 6.2 from 2019, 223; 7.0 from 2020, 228; 7.2 from 2021, 233; 7.4 from 2023, 252; 7.6 from 2026, 257. On Windows, add Windows itself: 1,537 commands in Windows PowerShell 5.1 on our Windows 11 PC, from 81 modules that come with Windows, for networking, disks, printers, updates and more. The cross-platform core grew from 208 to 257 cmdlets. On Windows we counted 625 cmdlets and 912 functions in modules stored in the Windows folder. Installed apps, like Azure tools, can add thousands more

That's only the core. Windows adds many more commands of its own for things like networking, disks and printers: on our Windows 11 test PC, we counted 1,537 commands in modules stored in the Windows folder. Add-ons, called modules, bring even more. The PowerShell Gallery, Microsoft's free online catalog, lets you install them with one command, Install-Module.

Where PowerShell comes from

Where PowerShell comes from. COMMAND.COM, the DOS prompt from 1981, was followed by the Command Prompt, cmd.exe, from Windows NT in 1993, then Windows PowerShell in 2006, when objects arrived, then PowerShell 7 in 2020, for Windows, Mac and Linux. Windows PowerShell borrowed ideas from Unix shells such as sh, ksh and Bash, including pipes, aliases and scripts, and from .NET and C#, including objects and types. PowerShell replaced the Command Prompt as the main command line in Windows, but cmd.exe is still there

In August 2002, a Microsoft engineer named Jeffrey Snover wrote a paper called the "Monad Manifesto". He admired how Unix administrators could automate anything by gluing small commands together with pipes. But Windows stored its information in structured form, not as text files, so copying Unix wasn't enough. His idea was to keep the pipes, but send objects through them.

The project, code-named Monad, was shown to the public in 2003 and renamed Windows PowerShell before its release in November 2006. Version 2.0 came built into Windows 7 in 2009 and added remoting, the ability to run commands on other computers. By 2017, Windows 10 had put PowerShell in place of the Command Prompt in its main menus.

Then came a surprise. On August 18, 2016, Microsoft made PowerShell open source and announced it would run on Mac and Linux too. Today its code is public on GitHub, where more than 55,000 people have starred it. Snover later became a Technical Fellow, one of Microsoft's most senior engineering titles.

A short history

A short history of PowerShell, as a timeline. 2002: Jeffrey Snover writes the "Monad Manifesto". 2006: Windows PowerShell 1.0 is released. 2009: 2.0 comes with Windows 7 and can control other PCs. 2012: 3.0 comes with Windows 8. 2016: 5.1, and PowerShell goes open source. 2017: Windows 10 puts it in place of the Command Prompt. 2018: PowerShell Core 6.0 runs on Mac and Linux. 2020: PowerShell 7 drops "Core" from its name. 2026: PowerShell 7.6, with a new release about every year

Try it yourself

  • Windows: right-click the Start button and choose Terminal, or search for PowerShell in the Start menu. That's Windows PowerShell 5.1. To get the modern version, type winget install --id Microsoft.PowerShell --source winget, then open PowerShell 7 from the Start menu.
  • Mac: download the PowerShell installer (.pkg) from Microsoft's PowerShell releases page on GitHub, open it, then type pwsh in the Terminal app.
  • Linux: Microsoft's documentation has instructions for Ubuntu, Debian, Fedora and others. Then type pwsh.

Then try a few safe commands. They only read information:

1Get-Date                                     # today's date and time
2Get-ChildItem                                # what's in this folder?
3Get-Process | Sort-Object CPU -Descending | Select-Object -First 5   # the 5 busiest programs
4Get-Command -Verb Get | Measure-Object       # how many Get commands are there?
5Get-Help Get-Process                         # explain a command
6$PSVersionTable.PSVersion                    # which PowerShell is this?

Two safety tips: commands with verbs like Remove, Stop and Set change things, so try -WhatIf first. And never paste a command from a stranger on the internet into PowerShell, especially one you don't understand. A shell does exactly what it's told.

Common questions

Is PowerShell the same as the Command Prompt? No. The Command Prompt (cmd.exe) is the older Windows shell, descended from DOS, and it's still there. PowerShell is newer and far more capable, though it understands many old habits, like dir and cd.

Is PowerShell the same as Bash? They're both shells, but from different families. Bash comes from Unix and passes text between commands. PowerShell comes from Windows and passes objects. Today you can run either one on Windows, Mac or Linux.

What's the Terminal app, then? Windows Terminal is just the window, with tabs. Inside it you can run PowerShell, the Command Prompt, or even Linux shells. Windows 11 uses it as the default.

Is PowerShell a programming language? Yes, a scripting language. It has variables, loops, decisions and functions, and because it's built on .NET, it can use the same building blocks as full programs written in C#.

Is it safe to experiment? Commands that start with Get only read things. Be careful with commands that remove, stop or change things, and use -WhatIf to preview them.

Glossary

  • PowerShell: Microsoft's shell and scripting language, built around objects.
  • Shell: a program that reads commands you type and runs them.
  • Cmdlet: a built-in PowerShell command, named Verb-Noun, like Get-ChildItem. Said "command-let".
  • Parameter: a named setting for a command, starting with a dash, like -Path.
  • Alias: a short nickname for a command, like dir for Get-ChildItem.
  • Object: a bundle of information with labeled properties, like a filled-in form.
  • Property: one labeled piece of an object, like a file's Length.
  • Pipeline: commands joined with |, passing objects from one to the next.
  • Variable: a name that holds a value, starting with $, like $photos.
  • Script: a .ps1 file of commands that runs like a program.
  • Execution policy: the setting that decides whether scripts may run on Windows.
  • Module: an add-on package of extra commands.
  • -WhatIf: a parameter that shows what a command would do, without doing it.

Wrapping up

PowerShell is the command line built into Windows, and now available on Mac and Linux too. Its commands have readable Verb-Noun names, and its big idea is that commands pass objects, filled-in forms of information, instead of plain text. That lets a few general commands sort, filter and count anything, from photos to programs.

It was born from a 2002 manifesto about bringing Unix-style automation to Windows, and it ended up going open source and running everywhere. You don't need to become an expert to get something out of it. Open a Terminal, type Get-Date, then Get-ChildItem, then Get-Help Get-ChildItem. Every Get command is safe, and every one of them answers in objects.

Thanks for reading!

Know someone who would enjoy this? Send it their way.

More articles

Read next

Comments

Be kind and specific. Comments with links from new accounts appear after a moderator reviews them.