Start here
PowerShell Tutorial for Beginners: Start Here
A clear, step-by-step path from your first PowerShell command to real automation. Follow the 10 steps in order, or jump straight to the task you need in the full list of 359 tutorials below.
Start with Step 1 Browse all 359 tutorials
- 359Free tutorials
- 10Steps from zero to scripts
- 15Topics
- 7 & 5.1PowerShell versions tested
Updated September 30, 2026
# Which version am I running? PS C:\> $PSVersionTable.PSVersion Major Minor Patch ----- ----- ----- 7 6 6 # Check two Windows services PS C:\> Get-Service -Name Spooler, W32Time Status Name DisplayName ------ ---- ----------- Running Spooler Print Spooler Running W32Time Windows Time PS C:\>
- A path in the right order, so each step builds on the last
- A practice task at every step to try on your own PC
- Every tutorial on the site, sorted by topic and searchable
The basics
What is PowerShell?
PowerShell is Microsoft’s command-line shell and scripting language for automating tasks. You type commands, called cmdlets, or save them in a script, and PowerShell does the work for you: checking hundreds of computers, renaming thousands of files or building a report in seconds.
Unlike Command Prompt, PowerShell passes objects, not plain text, from one command to the next. That’s why you can filter, sort and export results without cutting up text. Microsoft’s PowerShell overview covers the background.
I’ve used PowerShell every day for years to manage Windows servers, files and Microsoft 365. This page is the order I’d teach it in, with a practice task at each step.
- Two versions on WindowsWindows PowerShell 5.1 is built in. PowerShell 7 is the current version, and installs alongside it.
- Verb-Noun commandsCmdlets such as
Get-Service,Stop-ProcessandNew-Itemtell you what they do. - The pipelineThe
|symbol sends the results of one command straight into the next. - Runs almost everywherePowerShell 7 runs on Windows, macOS and Linux, and manages Microsoft 365 and Azure.
Choose your goal
Pick the Path That Fits You
Short on time? Each path is five tutorials that get you to a useful result fast. For the full picture, follow the 10-step roadmap below.
Beginner
New to PowerShell
Your first commands, variables, loops and functions, in order.
IT admin
Windows and IT admins
Check computers, software, services and disks, then manage them remotely.
Automation
Files and data
Find, copy and clean up files, then work with CSV and JSON data.
Microsoft 365
SharePoint Online admins
Connect with PnP PowerShell and manage sites, lists and files.
The learning roadmap
Learn PowerShell in 10 Steps
Work through the steps in order. Read the tutorials, run the examples yourself, then try the practice task before moving on.
-
Install and open PowerShell
Windows already includes Windows PowerShell 5.1. Install PowerShell 7 next to it for new work, and learn where each one opens.
- Check your version
- Install or update PowerShell 7
- Windows Terminal vs. PowerShell
- Open PowerShell in a folder
Try it: Run
$PSVersionTable.PSVersionin both versions and compare the numbers. -
Run commands and your first script
Commands follow a Verb-Noun pattern, like
Get-Service. Save a few of them in a .ps1 file and you have a script.Try it: Save
Get-DateandGet-Servicein hello.ps1, then run it from a PowerShell window. -
Variables and data types
Variables start with
$and can hold text, numbers, dates or whole objects. Knowing the type saves you from odd errors later.Try it: Store your name and today’s date in two variables and print them in one sentence.
-
Operators and conditions
Comparison operators such as
-eqand-likereturn True or False, andifandswitchact on the result.Try it: Check whether C: has less than 20 GB free and print a warning if it does.
-
Loops
Loops repeat the same work for every file, user or server. Most scripts use
foreachorForEach-Object.Try it: Loop through the files in a folder and print each name with its size in KB.
-
Strings, arrays and hashtables
Most real scripts clean up text and collect results. These are the tasks you’ll repeat most.
Try it: Split a comma-separated list of US states into an array and sort it.
-
The pipeline: filter, select and sort
The pipeline
|passes objects from one command to the next. This is where PowerShell becomes much faster than clicking.Try it: Show the five processes using the most memory, with only their name and memory.
-
Files, folders, CSV and JSON
Read, write, copy and clean up files, and turn data into CSV or JSON that other tools can use.
Try it: Export the list of running services to a CSV file and open it in Excel.
-
Functions, scripts and error handling
Wrap repeated code in functions with parameters, and handle failures with
tryandcatchso scripts don’t stop halfway.Try it: Turn your disk-space check into a function that takes a drive letter.
-
Automate real admin tasks
Put it all together: manage Windows computers, run commands on other PCs and automate Microsoft 365.
Try it: Write a daily report script that checks disk space and stopped services, and saves the result to a CSV file.
Your beginner toolkit
Set Up, Learn the Key Cmdlets and Fix Common Errors
Before you start
- Use PowerShell 7 for new scriptsKeep Windows PowerShell 5.1 for older modules. Microsoft explains the differences between the two.
- Install Visual Studio CodeWith the PowerShell extension you get IntelliSense and debugging. See the best VS Code extensions.
- Allow your own scriptsSet the execution policy to RemoteSigned with Set-ExecutionPolicy instead of turning protection off.
- Practice in a test folderWork in a folder such as C:\PSPractice, and add
-WhatIfto commands that change or delete things. - Run as administrator only when neededEveryday learning doesn’t need an elevated window. Tasks like installing features do.
Cmdlets to learn first
Fix common errors
Every tutorial on the site
All 359 PowerShell Tutorials by Topic
Looking for one task? Type a word like csv, service or date to filter the list.
- Get set up24
- Variables and data types25
- Operators10
- Strings and text37
- Arrays, lists and hashtables31
- Conditions and loops8
- Functions, scripts and errors9
- Filter, sort and format output19
- Files and folders51
- CSV, JSON, XML, Excel and file conversion19
- Dates and times19
- Windows system administration55
- Users, security and Active Directory27
- Networking, web and remote management15
- SharePoint Online with PnP PowerShell10
Get set up
24Install and update PowerShell, open it, run scripts and fix execution policy errors.
- 100 PowerShell Interview Questions and Answers
- Add Comments
- Best PowerShell Extensions for VS Code
- Change Directory
- Check the PowerShell Version
- Clear PowerShell History
- Enable PowerShell Logging
- Fix: The File Is Not Digitally Signed
- Fix “Running Scripts Is Disabled on This System”
- Get and Set Window Size
- Get Current Directory
- Fix: Install-Module Is Not Recognized
- List Installed PowerShell Modules
- Naming Conventions: Functions, Parameters and Variables
- Open PowerShell in a Folder
- PowerShell vs. Command Prompt (CMD)
- Run PowerShell as a Different User
- Run PowerShell Script From Command Line With Parameters
- Run PowerShell Script in PowerShell ISE
- Run PowerShell Script in Visual Studio Code
- Set Execution Policy
- Update PowerShell on Windows 11
- Why PowerShell Keeps Popping Up
- Windows Terminal vs. PowerShell
Variables and data types
25Topic guideCreate variables, work with types and objects, and use environment variables.
- Fix: Cannot Convert Value to Type System.Int32
- Fix: Cannot Convert Value to Type System.String
- Check if a Variable Exists
- Clear, Reset and Remove Variables
- Convert Secure String to Plain Text
- Convert Variables to Strings
- Create a Credential Object
- Create a GUID
- Create Objects
- Create Variables with Multiple Values
- Error Variables
- Escape Special Characters
- Generate Random Numbers
- Get All Properties of an Object
- Get the Type of an Object
- Global Variables and Scopes Explained
- Increment a Variable
- List All Environment Variables
- Pass Variables to a PowerShell Script
- Pipeline Variables
- Print a Variable
- Remove Environment Variables
- Set and Get Environment Variables
- Set Variables
- Single vs. Double Quotes
Operators
10Compare, match and combine values with PowerShell operators.
- The -like Operator and Wildcards
- The -match Operator
- Arithmetic Operators: +, -, *, /, %, ++ and More
- Comparison Operators: -eq, -ne, -gt, -ge, -lt, -le
- Contains Operator
- Filter Operators
- Logical Operators: -and, -or, -not, -xor and !
- Not Equal Operator (-ne)
- Question Mark Operator: Ternary, ??, ?. and $
- Round to 2 Decimal Places
- Add a New Line in a PowerShell String
- Add Double Quotes in a String
- Check if a String Contains a Substring
- Check if a String Contains Only Numbers
- Check if a String Contains Special Characters
- Check if a String Starts with a Number
- Compare Strings
- Concatenate String and Variable
- Concatenate Strings
- Convert a String to a Boolean
- Convert a String to a Hashtable
- Convert a String to an Integer
- Convert a String to Base64
- Convert a String to Binary
- Convert Multiline String to Single Line
- Convert Object to String
- Convert Strings to Uppercase, Lowercase and Title Case
- Count Occurrences of a Substring in a String
- Extract Text Between Delimiters
- Find a Character in a String
- Find a String in a File and Return the Line
- Generate Random Strings
- Get a Substring
- Get the First and Last Line of a Multiline String
- Get the Length of a String
- IsNullOrEmpty vs. IsNullOrWhiteSpace
- IsNullOrEmpty: Check if a Variable Is Null or Empty
- Regular Expressions (Regex)
- Remove Characters from Strings
- Remove Newline from String
- Remove Whitespace from Strings
- Replace Placeholders in Strings
- Replace Text in Strings
- Select-String: Search Files and Text
- Split a String
- Split a String and Get the Second Element
- Trim Strings
- Append to Array: +=, Lists and Common Mistakes
- Array vs. ArrayList vs. List
- Fix: Cannot Index into a Null Array
- Check if an Array Contains a Value
- Check if an Array is Empty
- Clear an Array
- Compare Two Arrays
- Convert a Byte Array to a String
- Convert an Array to a String
- Convert Object to Array
- Create a Character Array
- Create an Array of Objects
- Create an Empty Array
- Create and Manipulate Lists
- Expand Array
- Find Duplicates in an Array
- Get Array Length
- Get the First and Last Element of an Array
- Hashtables and Dictionaries
- Join Arrays
- Multidimensional Arrays
- Ordered Arrays
- Pick Random Items from an Array
- Print Arrays
- Remove Blank Lines from an Array
- Remove Duplicates from an Array
- Remove Items from an Array
- Replace Values in an Array
- Reverse An Array
- Sort an Array
- Split an Array into Smaller Arrays
Conditions and loops
8Make decisions with If and Switch, and repeat work with loops.
Functions, scripts and errors
9Write reusable functions and modules, take input and handle errors.
Filter, sort and format output
19Topic guideWhere-Object, Select-Object, Sort-Object and the Format and Write cmdlets.
- Compare-Object: Compare Two Lists
- Create a Table with Headers
- Create an HTML Table
- Format-List
- Format-Table: Columns, Sorting and Long Text
- Measure-Object in PowerShell: Sum, Average, Max and Count
- Out-GridView: Interactive Tables
- Output to File and Console at the Same Time
- Select-Object: Properties, -First, -Unique and More
- Sort-Object
- Where-Object Contains
- Where-Object for Null or Empty Values
- Where-object multiple conditions
- Where-Object vs. Select-Object
- Where-Object: Filter Objects With Examples
- Write-Host
- Write-Host Color
- Write-Host vs. Write-Output
- Write-Output
- Fix: Access to the Path Is Denied
- Add-Content: Append Text to a File
- Check if a File Contains a String
- Check If a File or Folder Is Empty
- Check Who Modified a File Last in Windows
- Copy and Rename Files
- Copy-Item: Copy Files and Folders
- Count Files in a Folder
- Count Lines in a File
- Create File If Not Exists
- Create Files with Content
- Create folder if not exist
- Create Multiple Folders
- Delete Contents of Folder
- Extract Directory from File Path
- Find a File by Name
- Find a Folder by Name
- Find All Files with a Specific Extension
- Find and Replace in File
- Find The Largest Folders
- Find the Most Recent File in a Directory
- Foreach File in Folder
- Get All Files in a Directory
- Get File Details and File Version
- Get File Name Without Extension
- Get Folder Size
- Get MD5 Hash of a File
- Get the File Name from a Path
- Get the Path of a File
- Get the Size of a File
- Get-ChildItem
- Get-ChildItem -Filter, -Include and -Exclude
- List Directories and Files
- List File Names Only
- List Hidden Files
- Move a File to a Folder
- New-Item: Create Files, Folders and Empty Files
- Open a File
- Out-File
- Read a File Line by Line
- Read Log Files
- Remove the Last Line from a File
- Remove-Item: Delete Files and Folders Safely
- Save Output to File
- Script to Delete Files Older Than 30 Days
- Show Progress When Copying Files
- Split Large Text Files
- Test-Path: Check If a File or Folder Exists
- Unblock Files Recursively Using Unblock-File
- Write a String to a File
- Write to a Log File
CSV, JSON, XML, Excel and file conversion
19Import, export and convert data files and documents.
- Convert Excel Files to CSV
- Convert Files to Base64
- Convert HEIC to JPG
- Convert HTML to PDF
- Convert HTML to Plain Text
- Convert JPG to PDF
- Convert JSON to CSV
- Convert PDF to Word
- Convert PNG to ICO
- Convert XML to Excel
- Convert XML to Table
- ConvertTo-Json
- Create CSV Files with Headers
- Export-Csv: Export Arrays, Hashtables and Tables to CSV
- Extract URLs from XML Sitemap
- Get Unique Values from CSV
- Read Excel Files into an Array
- Read JSON File into Array
- Write JSON to File
- Add a Date to a File Name
- Add Days to a Date
- Convert a String to a Date
- Convert Seconds to Hours and Minutes
- Create a Folder with the Current Date
- Date Comparison: Compare Dates the Right Way
- Find Files Modified After a Date
- Format Dates
- Get File Creation Date
- Get File Modified Date
- Get the Difference Between Two Dates
- Get the First Day of Next Month (and Other Month Dates)
- Get-Date Format ISO 8601
- Get-Date UTC
- Move Files from One Folder to Another
- Rename Files with Date
- Set the Time Zone
- Sort Files by Date
- Where-Object Between Two Dates
Windows system administration
55Hardware, software, updates, services, processes, printers and Windows settings.
- Can You Uninstall Microsoft Edge
- Change the Wallpaper
- Change Windows 11 Desktop Background Color
- Check for Windows Updates
- Check Free Memory
- Check Hard Drive Space
- Check if a Process is Running
- Create a Registry Key If It Doesn't Exist
- Create Desktop Shortcuts with Custom Icons
- Find an HP Laptop Product Number
- Find SQL Server Instances
- Find the Location of an Executable
- Find the Process Locking a File
- Get a List of Installed Programs
- Get BIOS Information
- Get Computer Information
- Get Computer Name
- Get Dell Service Tag
- Get HP BIOS Settings
- Get or Set the Default Browser
- Get the .NET Version
- Get the BIOS Serial Number
- Get the BIOS Version
- Get the Last Reboot Time
- Get the Windows Version
- Get Window Titles
- Get Windows Activation Status
- Get Windows Event Logs
- Get Windows Update History
- Get-Process: List and Find Processes
- Get-WindowsAutopilotInfo: Collect and Upload the Hardware Hash
- Install .NET Framework 3.5
- Install Git on Windows
- Install RSAT in Windows 11
- Install Snipping Tool in Windows 11
- Install Windows Updates
- Install winget
- Keep Your Screen Active
- Kill a Process by Name
- List Drives
- List Printers
- List Running Services
- List Scheduled Tasks
- List USB Devices
- List Windows Features
- Monitor and Manage CPU Usage
- Rename a Windows Computer
- Restart a Computer
- Restart a Windows Service
- Retrieve Your Windows Product Key
- Set Service to Automatic
- Set the Default Printer
- Start-Process
- Uninstall a Program
- Uninstall Firefox
Users, security and Active Directory
27Local users, passwords, profiles, certificates, BitLocker, firewall and domains.
- Add a Computer to a Domain
- Check if a User Account is Locked
- Check Password Expiration Date
- Convert Canonical Name to Distinguished Name
- Create a Local Admin Account
- Create a Password-Protected Zip File
- Create a Self-Signed Certificate
- Create Local Users in Windows
- Delete User Profiles
- Delete User Profiles Older Than 30 Days
- Disable Windows Defender
- Disable Windows Firewall
- Enable BitLocker
- Encrypt a File with a Password
- Find and Remove Stale Computer Objects in Active Directory
- Find the OU of a Computer
- Find Unquoted Service Paths
- Generate SSH Keys
- List Local Administrators
- List Local Users
- Random Password Generator
- Remove a Computer from a Domain
- Set Folder Permissions
- Set Password for Local User in Windows 11
- Set Password Never Expires for a Local User
- Show Logged-In Users
- Track User Login History on Windows
Networking, web and remote management
15IP addresses, ports, web requests, downloads and remote PowerShell.
- Check if a Port Is Open
- Convert a String to a URI
- Download Files
- Enable Remote Desktop
- Enable WinRM
- Find IP from MAC Address
- Find Ports in Use
- Get an IP Address
- Get JSON Data from a URL
- Get the Logged-On User on a Remote Computer
- Invoke-WebRequest: GET, POST, Download and Error Examples
- RPC Server is Unavailable Error
- Set a Proxy
- Test-NetConnection: Test Ports, Ping and Routes
- Use curl in PowerShell
No tutorial matches that word. Try a shorter word, or search the whole site.
PowerShell for Beginners: FAQs
What is PowerShell?
PowerShell is Microsoft’s command-line shell and scripting language for automating tasks. It works with objects instead of plain text, and PowerShell 7 runs on Windows, macOS and Linux.
Is PowerShell hard to learn?
Not if you learn it in order. Commands use a predictable Verb-Noun pattern, like Get-Service and Stop-Process, so after the first few you can often guess the rest.
Should I learn PowerShell 7 or Windows PowerShell 5.1?
Learn PowerShell 7 for new scripts, because it’s the version Microsoft keeps improving. Windows PowerShell 5.1 still ships with Windows, so it helps to know the few places where the two behave differently.
Is PowerShell free?
Yes. Windows PowerShell 5.1 is part of Windows, and PowerShell 7 is a free, open-source download from Microsoft.
Do I need administrator rights to learn PowerShell?
No. Most learning works in a normal window. You only need Run as administrator for tasks that change Windows itself, such as installing features or managing services.
How do I practice PowerShell safely?
Practice in a test folder, add -WhatIf to commands that change or delete things, and try new scripts on a test computer before using them at work.
What is the difference between PowerShell and Command Prompt?
Command Prompt runs text-based commands and batch files. PowerShell passes objects through a pipeline, has thousands of cmdlets and can manage Windows, Microsoft 365 and Azure.
Free PDF download
100 PowerShell Cmdlets with Examples
Keep the most useful PowerShell cmdlets in one handy PDF while you learn, each with a short explanation and an example you can run.
You’ll also get new PowerShell tutorials by email. Unsubscribe anytime.
Written by Bijay Kumar, a 13-time Microsoft MVP with 18+ years of hands-on experience. Scripts are run on PowerShell 7 and Windows PowerShell 5.1 before they’re published. Found a problem? Email bijay@powershellfaqs.com.