Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

6.3.2.7. Lab 7: PowerShell Basics

6.3.2.7. Lab 7: PowerShell Basics (45 minutes)

Objective: Execute basic PowerShell commands and understand the object pipeline.

Setup: Windows computer with PowerShell (built-in)

Steps:
  1. Check and Set Execution Policy
    Get-ExecutionPolicy
    # If Restricted, run PowerShell as Admin and execute:
    Set-ExecutionPolicy RemoteSigned
    
  2. Basic Commands
    # Get help on any command
    Get-Help Get-Process
    
    # List all processes
    Get-Process
    
    # List top 10 processes by CPU usage
    Get-Process | Sort-Object CPU -Descending | Select-Object -First 10
    
    # List all services
    Get-Service
    
    # List only running services
    Get-Service | Where-Object {$_.Status -eq "Running"}
    
  3. Working with Objects
    # Store processes in a variable
    $procs = Get-Process
    
    # Access properties of the first process
    $procs[0].Name
    $procs[0].CPU
    $procs[0].WorkingSet64 / 1MB  # Memory in MB
    
  4. Create a Simple Script
    • Open Notepad and write:
      Write-Host "System Information Script" -ForegroundColor Cyan
      Write-Host "========================="
      $os = Get-CimInstance Win32_OperatingSystem
      Write-Host "Computer: $($os.CSName)"
      Write-Host "OS: $($os.Caption)"
      Write-Host "Version: $($os.Version)"
      
    • Save as SystemInfo.ps1 on your Desktop
    • Open PowerShell, navigate to Desktop, run: .\SystemInfo.ps1

Deliverable: Your working SystemInfo.ps1 script.

Alvin Varughese
Written byAlvin Varughese
Founder•15 professional certifications