PowerShell Fundamentals
BeginnerPowerShell is an object-oriented shell—commands return objects with properties and methods, not just text.
Concept Overview
# Get help on any cmdlet
Get-Help Get-Process -Detailed
Get-Help Get-Service -Examples
# Discover commands
Get-Command -Verb Get # All "Get" cmdlets
Get-Command -Noun *Process* # Commands about processes
# Explore object properties
Get-Process | Get-Member # List all properties/methods
Get-Service | Get-Member -MemberType Property
# Variables
$name = "PowerShell"
$version = $PSVersionTable.PSVersion
Write-Host "Running $name version $version"
Object Pipeline vs Text Pipeline
Unlike Bash where commands output text, PowerShell outputs objects. When you pipe to another cmdlet, you're passing rich objects with properties—not parsing text!
Tasks
- Open PowerShell and check your version with
$PSVersionTable - Use
Get-Commandto find all cmdlets with "Event" in the noun - Run
Get-Helpon 3 different cmdlets - Create variables for your name, favorite number, and a boolean
- Use
Get-Memberto explore the properties of a DateTime object
# Exploring DateTime object
$now = Get-Date
$now | Get-Member
$now.DayOfWeek
$now.AddDays(30)