PowerShell Basics Level: Beginner Chapter 2: Your First PowerShell Commands

What is PowerShell

PowerShell is a command line shell and a scripting language. It is built on .NET, and it works with objects instead of plain text.

Lesson 1 of 5 in Chapter 2: Your First PowerShell Commands. Previous step in this path: Boot Phases and Boot Defenses. 3 learning objectives, 6 examples, and a knowledge check.

Start: what you will learn

PowerShell is a command line shell and a scripting language. It is built on .NET, and it works with objects instead of plain text.

Learning objectives

  • Describe PowerShell in one clear sentence
  • Explain the difference between text output and object output
  • Name one everyday admin task PowerShell can automate

Concept in simple words

What it is: PowerShell is a tool that lets you manage a computer by typing commands, and it is also a language for saving those commands as a script you can run again. A shell is the place where you type a command and see the result. A scripting language is the same idea, but the commands are saved in a file, so you can run the same steps again without typing them one by one.

Why it works

Why it exists: Before tools like this, many computer jobs had to be done by hand, one click at a time. That was slow, and it was easy to miss one item or to do the same job a little differently each time. PowerShell exists so you can ask the computer to do the same job for many items at once, in the same way, every time.

What problem it solves: Imagine you need to check a long list of services, or to find every running program on a computer. Doing that by hand means opening many windows and reading many screens. With one PowerShell command, you can ask for the whole list at once, and then keep only the parts you need.

Why it works this way: When you run a command, PowerShell usually returns objects, not just text on the screen. An object is a structured result, and it keeps its facts together, so PowerShell can sort it, filter it, and show only the parts you ask for. The facts on an object are called properties. The actions an object can do are called methods. For now, focus on properties, because they are the facts you will read most often.

What .NET means here, in simple words: PowerShell is built on .NET, which is a large set of ready made building blocks for programs. You do not need to learn .NET to use PowerShell. It is enough to know this: because PowerShell uses those building blocks, its results come back as structured objects, with a type, properties, and methods, instead of as loose lines of text.

Think of it like this

Think of it like this: Text output is like a printed list, where you have to read every line by eye. Object output is like a set of labelled boxes, where each box already has a name, an id, and other facts printed on it, so you can ask for exactly the box or the fact you want. If the printed list changes its spacing, a reader by eye can get confused. A labelled box does not have that problem, because the fact still has its label.

A second analogy that helps: Think of a contact card. A card has a name, a phone number, and an email address, each in its own field. You would not cut up a printed phone book to find one number if you could just ask for the phone field on the card. A PowerShell object works the same way. You ask for the property you want, and PowerShell gives you that field.

How it works, step by step

How it works, step by step: First, you type a command and press Enter. PowerShell reads the command, finds the tool behind it, and runs it. Then it returns the result, usually as objects, and shows those objects as a table or a list on the screen. The table you see is only a display. The real result underneath is still a set of objects.

How it works, step by step, continued: Next, you can take that result and do more with it, for example by keeping only some properties, which are the facts stored on each object, or by keeping only the objects that match a test. You do not need to rewrite the command, you just add another step. That idea, take a result and add a step, is the heart of PowerShell, and later chapters build on it with the pipeline.

How the display can mislead you, and how to stay safe: The table on the screen shows only a few properties, chosen for a quick view. It does not show every property the object has. So if a column is missing, do not assume the object has no such fact. You can ask PowerShell to show the members of an object, and that is what the Get-Member example below does. Get-Member lists properties and methods, so you can see what is really there.

Let us walk through an example: In Get-Date, Get is the verb, which tells PowerShell what to do, and Date is the noun, which tells it what to work on. The output is a date object, not just a line of text, so you can ask for one fact from it, such as the day, instead of reading the whole line and guessing. A date object has facts like Year, Month, Day, Hour, and Minute, and you can read one fact with dot notation, for example (Get-Date).Year.

Walkthrough, what changes if you change one part: If you run Get-Date on its own, you see the full current date and time. If you run (Get-Date).Year, you see only the year, because you asked for one property. If you run (Get-Date).Day, you see only the day of the month. The command did not change what date it is. It only changed which fact you asked to see. That is the power of an object. One result, many facts, and you choose the fact.

Let us walk through a second example: In Get-Process, Get is again the verb, and Process is the noun. The result is a set of process objects, one for each running program. Each object has facts such as Name, Id, and CPU. The Id is a number that identifies one running program. CPU is a measure of processor time that program has used. When you see a table, each row is one object, and each column is one property.

Walkthrough, what to look for in the output: Look first at the column headings. They tell you which properties are being shown. Then look at one row from left to right, and read it as one object: this program, with this id, and this CPU value. Then try the Select-Object example. The rows stay the same, but the columns shrink to only Name and Id, because you asked for only those two properties. Nothing was deleted from your computer. You only changed the display.

A safe first habit: Start with commands that only read information, such as Get-Date, Get-Process, and Get-Service. These commands ask a question. They do not change settings, stop programs, or delete files. When you are learning, reading first is always the safe choice. Only move to a command that changes something after you have read its help and you understand every part of it.

What PowerShell is not: PowerShell is not only a black window for typing. It is not a different computer, and it is not a website. It runs on your own computer, it reads your own computer, and the commands in this chapter only look at information. If a command asks you to change something, stop and check what it changes before you press Enter.

When to use it

When to use it, and when not to: Use PowerShell when you need to repeat a task, check many items at once, or manage settings in a clear and repeatable way. Do not use it for a change you do not understand yet, and do not run a command that deletes or changes things before you have read what it does. A good test is this: if you cannot explain the command in one simple sentence, read its help first.

Common edge cases to expect: First, your process list will look different from any example, because your computer runs different programs, and the numbers change as programs start and stop. That is normal, and it does not mean you did it wrong. Second, some commands show more columns on a wide window and fewer on a narrow window. Third, a property can be empty for one object and filled for another, because not every program reports every fact in the same way.

Worked examples

Read each example in order. Each one explains its parts, then shows what to look for in the output.

Syntax

Syntax
Get-Process

Example 1

Lists running processes as objects. Each row is one process object.

Example 1
Get-Process

Illustrative output: Name Id CPU ---- -- --- pwsh 1234 12.5

Example 2

Keeps only two properties from each process object. The pipe is covered in Chapter 2.

Example 2
Get-Process | Select-Object Name, Id

Illustrative output: Name Id ---- -- pwsh 1234

Example 3

Get-Date is a simple read only command. Get is the verb, Date is the noun, and the result is a date object that holds facts such as the day, month, and year. Try it first, before you try commands that change anything.

Example 3
Get-Date

Illustrative output: Monday, 3 November 2026 10:00:00

Example 4

Dot notation reads one property from the date object. The brackets run Get-Date first, then .Year reads only the year fact from that result. Change Year to Month or Day to see a different fact from the same date.

Example 4
(Get-Date).Year

Illustrative output: 2026

Example 5

Select-Object keeps only the three properties you name. The date object is unchanged, you only asked to see less of it. Look for the three column headings, Year, Month, and Day, and one row with the current values.

Example 5
Get-Date | Select-Object Year, Month, Day

Illustrative output: Year Month Day ---- ----- --- 2026 11 3

Example 6

Get-Member lists the properties an object has, so you can see what facts are available before you try to select one. Look for the MemberType column, which says Property, and the Name column, which gives the property name. This is a read only inspection, it changes nothing on your computer.

Example 6
Get-Process | Get-Member -MemberType Property

Illustrative output: Name MemberType Definition ---- ---------- ---------- Id Property int Id Name Property string Name

Nothing on this page executes PowerShell code. The outputs above are illustrative only.

Common mistakes and troubleshooting

Read these before you try the examples, so you can spot the same problems in your own work.

  • Treating output as plain text and trying to cut it up by hand, when the object already has the property you need.
  • Running a command that changes something before you understand what it does. Read it first, then run it.
  • Typing a command that changes or deletes something just because it appeared in a search result, without first reading what each part of it does.
  • Assuming the table on the screen shows every property. It shows only a few, chosen for display. Use Get-Member to see the full list of properties before you conclude that a fact does not exist.
  • Expecting your process list, ids, or CPU numbers to match an example exactly. They change as programs start and stop, so compare the shape of the output, column headings and one row per object, not the exact numbers.
  • Confusing a property with a method. A property is a fact you read, such as Name. A method is an action, and it is written with brackets at the end. In this chapter, stick to reading properties, and leave methods for later.

Knowledge check

Knowledge check

What does PowerShell mainly work with?

Pick one answer. Feedback appears right away, and you can try again.

Remember this and next step

Remember this: PowerShell is a command tool and a scripting language, it works with objects, and objects keep their facts in properties, which you can sort, filter, and select. Start with read only commands, read one property at a time, and let the object do the work that you used to do by eye.

Next step: PowerShell versions