Skip to content

Getting Started

First experience with PowerShell's basic commands and help system:

  • Discover commands and help:
    • Get-Command: Search for available commands, functions, scripts, aliases
    • Get-Help <Cmdlet>: View command usage and examples; -Online opens web page; -Full shows complete help
  • View system information:
    • Get-Process, Get-Service, Get-EventLog / Get-WinEvent
    • Get-ChildItem (aliases: ls, dir): List directory
    • Get-Item / Set-Item: Read/write files/registry/environment variables and other general "provider" resources
  • Pipeline and filtering:
    • Where-Object (alias: ?) filters objects
    • Select-Object (alias: select) projects properties
    • Sort-Object (alias: sort) sorts

Example: List the top 5 processes by memory usage, showing only name and working set, sorted by memory in descending order.

powershell
Get-Process |
  Sort-Object -Property WorkingSet -Descending |
  Select-Object -First 5 -Property Name, Id, @{n='MemoryMB';e={[math]::Round($_.WorkingSet/1MB,2)}}

Running scripts:

  • Use .\script.ps1 to execute scripts in the current directory
  • May need to set execution policy: Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned

Editor recommendations:

  • VS Code + PowerShell extension: Syntax highlighting, IntelliSense, debugging, code snippets, and refactoring support

Content is for learning and research only.