01 / GETTING STARTED · LESSON 01

Your first PowerShell command

Run a command and recognise the difference between your code and its output.

6 min · learn at your pace

Meet your new toolkit

PowerShell is a language and a shell: a place to give a computer instructions. You can use one command to answer a question, or combine many commands into a script that handles a repeatable task.

The lab runs a real PowerShell engine in your browser. There is nothing to install. Its files belong to a virtual practice workspace, so an exercise does not modify files on your computer.

Say something

Put text inside quotes and PowerShell sends that text to its output stream. The quotes tell PowerShell where the text begins and ends; they are not part of the result.

'Hello from the lab!'

Select Run code to execute the editor. The terminal below shows what happened. You can also type a command at the PS /home/user> prompt and press Enter. The editor and terminal share a session.

A line starting with # is a comment. Use comments to explain why a script exists. PowerShell ignores them when it runs your code.

Practise, then check

Run your code as often as you like. When you are happy with it, select Check answer. Checking starts from the lesson's original files and runs your saved editor text in a fresh session. This makes the result repeatable.

Try an example.ps1
'Hello from the lab!'
YOUR TURN

Put it into practice.

Print the greeting Hello, PowerShell! to the output stream. The spelling and punctuation should match.

See an explained solution
One way to solve it.ps1
'Hello, PowerShell!'

A string expression is enough to produce output in PowerShell. Write-Output can also send that string to the output stream.