PowerShell Introduction
In most people's impression, Windows command-line tools are either the long-outdated cmd, or the hair-loss-inducing 'click around in the GUI'. But in fact, as early as 2006 Microsoft launched a powerful modern command-line tool designed for system administrators -- PowerShell.
PowerShell is a cross-platform (Windows / Linux / macOS) automation and configuration management framework introduced by Microsoft, composed of two parts: a 'command-line shell (host)' and a 'scripting language'.
PowerShell is built on .NET (the full .NET Framework or .NET Core / .NET 6+), so it can call thousands of .NET APIs directly and natively supports an object-oriented pipeline rather than the plain text stream of traditional shells.
PowerShell is built on the .NET Framework, designed for system administrators and advanced users to automate various system management tasks.
PowerShell's core features
- Object-oriented: Unlike traditional command-line tools that process text, PowerShell works directly with .NET objects
- Powerful pipeline capabilities: You can easily pass the output of one command to another
- Extensibility: You can create custom cmdlets (commands) and modules
- Cross-platform support: PowerShell Core can run on Windows, Linux, and macOS
Development History
In UNIX systems, shells like bash, sh, and csh have long been indispensable assistants to system administrators. Windows had long been lacking in this area until the arrival of PowerShell filled that gap. It can not only execute commands like a UNIX shell but also integrates a scripting language and various helper tools, taking automation to the next level.
| Year | Version | Key milestones |
|---|---|---|
| 2006 | PowerShell 1.0 | Shipped with Windows Vista; first appearance |
| 2009 | PowerShell 2.0 | Introduced Remoting (remote control), module support, and background jobs |
| 2012 | PowerShell 3.0 | Added Workflow, scheduled tasks, CIM, and other features |
| 2016 | PowerShell 5.1 | Built into Windows 10; the last generation based on the .NET Framework |
| 2018 | PowerShell Core 6.0 | Officially open sourced, fully cross-platform, migrated to GitHub |
| 2020 | PowerShell 7.0 | Based on .NET Core 3.1; first version able to coexist with Windows PowerShell |
| 2023 | PowerShell 7.4 | Based on .NET 8; performance and compatibility continuously improved, with native container support |
PowerShell vs. Traditional Command Lines
| Comparison Item | PowerShell | Traditional command line (Bash / CMD) |
|---|---|---|
| Data Type | Objects (.NET objects) | Strings / text |
| Pipeline transport | Passes objects | Passes text |
| Command style | Verb-noun (such as Get-Process) |
Short commands (such as ps, ls) |
| Scripting capability | Full programming language (supports functions, classes, exceptions) | Simple script syntax |
| Error handling | try-catch Exception mechanism |
Based on exit codes $?, $LASTEXITCODE |
| Module System | Natively supported, with version control and auto-loading | Relies on external commands or source imports |
| Remote execution | Built-in Remoting, SSH | Bash relies on ssh, expect, etc.; CMD does not support it |
| Resource access | Supports multiple Providers (registry, variables, certificates, etc.) | Mainly operates on the file system |
| Cross-platform | Yes (PowerShell Core / 7+) | Bash yes, CMD no |
| Extensibility | Can call .NET / custom Cmdlets | Relies on third-party command-line tools |
| Output handling | Structured object processing, pipeline chaining | Plain text needs to be processed with grep / awk and similar tools for parsing |
Who should learn it?
- System administrators: batch-manage servers, automate deployment, control configuration
- Developers: build DevOps pipelines, scripting tools, and test toolchains
- Data analysts: automatically process logs, extract data, and integrate systems
- Beginners: learn command-line programming and understand underlying OS mechanisms
PowerShell is not just a command-line tool; it is more like an advanced automation platform. Whether you are an operations engineer, a developer, or an ordinary user who wants to master Windows, PowerShell is worth learning in depth.
It is more flexible than cmd and more powerful than bash, and most importantly -- it is becoming the automation infrastructure tool of the new era with a cross-platform posture.