
π This article includes 2 downloadable practice files β
In this article
PowerShell is a task automation and configuration management framework developed by Microsoft, consisting of a command-line shell and a deeply integrated scripting language. Unlike traditional shells that output plain text (such as Bash or CMD), PowerShell passes structured .NET objects through its pipeline. This fundamental difference means you never need to rely on brittle text parsing tools like awk or sed to extract columns or properties.
Understanding Cmdlets and the Verb-Noun Syntax
Every native PowerShell command is called a cmdlet (pronounced command-let) and follows an intuitive Verb-Noun naming convention. The verb describes the action (e.g., Get, Set, New, Remove, Start, Stop), while the noun specifies the resource being operated upon (e.g., Process, Service, Item, Date, Content).
# Core Verb-Noun examples
Get-Date -Format "yyyy-MM-dd HH:mm:ss" # Retrieve current timestamp
Get-Service -Name "wuauserv" # Check Windows Update service state
Get-Process | Where-Object WorkingSet -gt 100MB # Active processes using >100MB RAM
Basic Level: Command Discovery and Help System
You never have to memorize hundreds of command names in PowerShell because the engine provides three built-in discovery cmdlets:
Get-Command: Discovers cmdlets, functions, and aliases installed on your system.Get-Help: Displays detailed documentation, parameter explanations, and real-world syntax.Get-Member: Inspects any object to reveal all its available properties and methods.
# 1. Discover all commands related to network IP configuration
Get-Command -Noun *IPConfiguration*
# 2. View official examples with copy-pasteable syntax
Get-Help Get-ChildItem -Examples
# 3. View the complete manual with parameter details
Get-Help Copy-Item -Detailed
Intermediate Level: Execution Policies and Script Security
When you attempt to run a saved .ps1 script on a fresh Windows machine, Windows blocks execution by default under the Restricted execution policy to protect users from malicious scripts downloaded from the web.
Safe Policy Configuration
To safely permit your own scripts while protecting system files, set the execution policy for your current user account to RemoteSigned:
# Check current effective policy across all scopes
Get-ExecutionPolicy -List
# Safely permit local scripts for your user account
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
Under RemoteSigned:
- Scripts written locally on your computer run without restriction.
- Scripts downloaded from the internet (tagged with a browser Zone.Identifier) require a trusted digital signature, or must be unblocked using
Unblock-File -Path .myscript.ps1.
Expert Level: PowerShell 5.1 vs PowerShell 7 (Core)
Modern enterprise environments frequently contain two parallel versions of PowerShell:
| Feature | Windows PowerShell 5.1 | PowerShell 7.x (Core) |
|---|---|---|
| Runtime Engine | .NET Framework 4.8 | .NET 8 / 9 (Modern) |
| Platform Support | Windows only (built-in) | Windows, macOS, Linux |
| Execution Path | powershell.exe |
pwsh.exe |
| Parallel Processing | Workflow / Runspaces | Native ForEach-Object -Parallel |
| Ternary Operator | Not supported | ? : |
# High-speed parallel processing in PowerShell 7+
1..20 | ForEach-Object -Parallel {
Test-Connection -TargetName "192.168.1." -Count 1 -Quiet
} -ThrottleLimit 10
Practice Exercise
- Open PowerShell and run
Get-Command -Verb Testto see all diagnostics cmdlets. - Use
Get-Date | Get-Memberto view all properties of the DateTime object. Notice thatDayOfWeekandDayOfYearare accessible without string manipulation.
π Practice files for this article
β¬ Download all 2 files (ZIP Β· 459 B)
- π₯οΈps-01-basics.ps1Lesson code file.β¬ PS1 Β· 223 B
- πps-01-basics-output.txtOutput from our test run.β¬ TXT Β· 34 B
Free to use for learning. Files with macros (.bas) are plain text β import them with Alt+F11 β File β Import File, and always test on a copy.
Stuck on a step? Ask a question and the AI answers using this article.