Introduction to PowerShell
Learn what PowerShell is, why it matters, and how it differs from traditional command prompts. Understand the PowerShell ecosystem and its capabilities.
What is PowerShell?
PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework. Unlike traditional text-based shells, PowerShell works with objects rather than plain text, making it incredibly powerful for system administration and automation.
Originally released in 2006 as Windows PowerShell, it was built on the .NET Framework and was exclusive to Windows. In 2016, Microsoft open-sourced it as PowerShell Core (now just called PowerShell), making it available on Windows, macOS, and Linux.
Why Learn PowerShell?
There are several compelling reasons to learn PowerShell:
- System Administration — Manage Windows servers, Active Directory, Exchange, Azure, and more
- Automation — Automate repetitive tasks that would take hours manually
- Cross-Platform — PowerShell 7+ runs on Windows, macOS, and Linux
- Object-Oriented — Work with structured data instead of parsing text
- Integration — Connects with .NET, REST APIs, databases, cloud services
- Career Growth — Essential skill for DevOps, SysAdmin, and Cloud Engineering roles
PowerShell vs Command Prompt (CMD)
| Feature | Command Prompt | PowerShell |
|---|---|---|
| Output | Plain text | .NET Objects |
| Scripting | Batch files (.bat) | PowerShell scripts (.ps1) |
| Pipeline | Text only | Object pipeline |
| Aliases | Limited | Extensive |
| Remote Management | Limited | Full remoting support |
| Cross-Platform | Windows only | Windows, macOS, Linux |
| Extensibility | Very limited | Modules, snap-ins |
PowerShell vs Bash
While Bash is the default shell on Linux/macOS, PowerShell offers unique advantages:
- Bash processes text streams — you pipe text and parse it with tools like
grep,awk,sed - PowerShell processes objects — you pipe structured objects with properties and methods
# Bash: Get process names (text parsing)
# ps aux | grep nginx | awk '{print $11}'
# PowerShell: Get process names (object access)
Get-Process | Where-Object { $_.Name -eq "nginx" } | Select-Object Name, CPUBoth have their strengths, and knowing both makes you a versatile engineer.
PowerShell Versions
| Version | Release Year | Platform | Status |
|---|---|---|---|
| Windows PowerShell 5.1 | 2016 | Windows only | Maintenance mode |
| PowerShell 7.0 | 2020 | Cross-platform | End of life |
| PowerShell 7.2 | 2021 | Cross-platform | LTS |
| PowerShell 7.4 | 2023 | Cross-platform | LTS (Current) |
| PowerShell 7.5 | 2024 | Cross-platform | Latest |
Recommendation: Use PowerShell 7.4+ for new projects. Windows PowerShell 5.1 comes pre-installed on Windows but is no longer being actively developed.
Key Concepts to Understand
Before diving in, here are core concepts you'll learn:
- Cmdlets — Built-in commands following the
Verb-Nounpattern (e.g.,Get-Process) - Pipeline — Chain commands together, passing objects from one to the next
- Objects — Everything in PowerShell is a .NET object with properties and methods
- Modules — Packages of cmdlets that extend PowerShell's functionality
- Providers — Interfaces that let you access data stores (file system, registry, etc.) like drives
- Remoting — Execute commands on remote machines
What You'll Build in This Tutorial Series
By the end of these tutorials, you'll be able to:
- Navigate and manage files/folders efficiently
- Write scripts to automate system administration tasks
- Process and transform data using the pipeline
- Create reusable functions and modules
- Manage remote systems
- Work with APIs and external services
- Handle errors gracefully
- Write production-ready automation scripts
Let's get started by installing PowerShell on your system!