# SystemInfo.ps1
# This script displays basic system information for Windows 11
# Author: Educational PowerShell Scripts
# Date: May 21, 2025
# Start with a title
Write-Host "`n============ Windows 11 System Information ============`n" -ForegroundColor Cyan
# Get basic system information
Write-Host "COMPUTER SYSTEM INFORMATION" -ForegroundColor Green
Get-ComputerInfo | Select-Object WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer, CsManufacturer, CsModel | Format-List
# CPU information
Write-Host "`nCPU INFORMATION" -ForegroundColor Green
Get-CimInstance -ClassName Win32_Processor | Select-Object Name, NumberOfCores, NumberOfLogicalProcessors, MaxClockSpeed | Format-List
# Memory information
Write-Host "`nMEMORY INFORMATION" -ForegroundColor Green
$totalRAM = (Get-CimInstance -ClassName Win32_PhysicalMemory | Measure-Object -Property Capacity -Sum).Sum / 1GB
Write-Host "Total RAM: $($totalRAM.ToString('N2')) GB"
# Disk information
Write-Host "`nDISK INFORMATION" -ForegroundColor Green
Get-CimInstance -ClassName Win32_LogicalDisk -Filter "DriveType=3" |
Select-Object DeviceID,
@{Name="Size(GB)"; Expression={$_.Size / 1GB -as [int]}},
@{Name="FreeSpace(GB)"; Expression={$_.FreeSpace / 1GB -as [int]}},
@{Name="% Free"; Expression={($_.FreeSpace / $_.Size * 100) -as [int]}} |
Format-Table -AutoSize
# Network information
Write-Host "`nNETWORK INFORMATION" -ForegroundColor Green
Get-NetAdapter | Where-Object Status -eq "Up" |
Select-Object Name, InterfaceDescription, Status, LinkSpeed |
Format-Table -AutoSize
Write-Host "`n============ End of System Information ============`n" -ForegroundColor Cyan
# Pause at the end so user can see the results
Write-Host "Press any key to continue..."
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
# FileExplorer.ps1
# Interactive file explorer tool for Windows 11
# Author: Educational PowerShell Scripts
# Date: May 21, 2025
function Show-Menu {
param (
[string]$Title = 'PowerShell File Explorer'
)
Clear-Host
Write-Host "================ $Title ================"
Write-Host "Current location: $($PWD.Path)"
Write-Host ""
Write-Host "1: List files and folders"
Write-Host "2: Navigate to a directory"
Write-Host "3: View file content"
Write-Host "4: Create a new folder"
Write-Host "5: Create a new file"
Write-Host "6: Delete a file or folder"
Write-Host "7: Search for files"
Write-Host "Q: Quit"
Write-Host ""
}
function List-FilesAndFolders {
Write-Host "`nDIRECTORIES:" -ForegroundColor Cyan
Get-ChildItem -Directory | Format-Table Name, LastWriteTime, @{Name="Type"; Expression={"Directory"}} -AutoSize
Write-Host "`nFILES:" -ForegroundColor Cyan
Get-ChildItem -File | Format-Table Name, Length, LastWriteTime, Extension -AutoSize
Write-Host ""
}
function Navigate-To {
$path = Read-Host "Enter directory path (absolute or relative)"
try {
if (Test-Path -Path $path -PathType Container) {
Set-Location -Path $path
Write-Host "Successfully navigated to $($PWD.Path)" -ForegroundColor Green
} else {
Write-Host "Invalid directory path!" -ForegroundColor Red
}
} catch {
Write-Host "Error navigating to directory: $_" -ForegroundColor Red
}
Write-Host ""
Read-Host "Press Enter to continue"
}
function View-FileContent {
$path = Read-Host "Enter file name or path"
try {
if (Test-Path -Path $path -PathType Leaf) {
$content = Get-Content -Path $path -Raw
Write-Host "`nFILE CONTENT: $path" -ForegroundColor Cyan
Write-Host "-----------------------------"
Write-Host $content
Write-Host "-----------------------------"
} else {
Write-Host "Invalid file path!" -ForegroundColor Red
}
} catch {
Write-Host "Error reading file: $_" -ForegroundColor Red
}
Write-Host ""
Read-Host "Press Enter to continue"
}
function Create-Folder {
$name = Read-Host "Enter new folder name"
try {
if (!(Test-Path -Path $name)) {
New-Item -Path $name -ItemType Directory | Out-Null
Write-Host "Folder '$name' created successfully" -ForegroundColor Green
} else {
Write-Host "A folder with that name already exists!" -ForegroundColor Yellow
}
} catch {
Write-Host "Error creating folder: $_" -ForegroundColor Red
}
Write-Host ""
Read-Host "Press Enter to continue"
}
function Create-File {
$name = Read-Host "Enter new file name (with extension)"
try {
if (!(Test-Path -Path $name)) {
$content = Read-Host "Enter file content (or press Enter for empty file)"
$content | Out-File -FilePath $name
Write-Host "File '$name' created successfully" -ForegroundColor Green
} else {
Write-Host "A file with that name already exists!" -ForegroundColor Yellow
}
} catch {
Write-Host "Error creating file: $_" -ForegroundColor Red
}
Write-Host ""
Read-Host "Press Enter to continue"
}
function Delete-Item {
$path = Read-Host "Enter name of file or folder to delete"
try {
if (Test-Path -Path $path) {
$confirm = Read-Host "Are you sure you want to delete '$path'? (Y/N)"
if ($confirm -eq 'Y' -or $confirm -eq 'y') {
Remove-Item -Path $path -Recurse -Force
Write-Host "'$path' deleted successfully" -ForegroundColor Green
} else {
Write-Host "Deletion cancelled" -ForegroundColor Yellow
}
} else {
Write-Host "File or folder not found!" -ForegroundColor Red
}
} catch {
Write-Host "Error deleting item: $_" -ForegroundColor Red
}
Write-Host ""
Read-Host "Press Enter to continue"
}
function Search-Files {
$pattern = Read-Host "Enter search pattern (supports wildcards like *.txt)"
try {
$results = Get-ChildItem -Recurse -File -Filter $pattern
Write-Host "`nSEARCH RESULTS:" -ForegroundColor Cyan
if ($results.Count -gt 0) {
$results | Format-Table FullName, Length, LastWriteTime -AutoSize
} else {
Write-Host "No files found matching the pattern '$pattern'" -ForegroundColor Yellow
}
} catch {
Write-Host "Error searching for files: $_" -ForegroundColor Red
}
Write-Host ""
Read-Host "Press Enter to continue"
}
# Main program loop
do {
Show-Menu
$input = Read-Host "Please make a selection"
switch ($input) {
'1' { List-FilesAndFolders }
'2' { Navigate-To }
'3' { View-FileContent }
'4' { Create-Folder }
'5' { Create-File }
'6' { Delete-Item }
'7' { Search-Files }
'q' { continue }
default { Write-Host "Invalid option, please try again." -ForegroundColor Red; Read-Host "Press Enter to continue" }
}
} until ($input -eq 'q')
# ProcessMonitor.ps1
# A simple process monitoring tool for Windows 11
# Author: Educational PowerShell Scripts
# Date: May 21, 2025
function Show-Menu {
param (
[string]$Title = 'Process Monitor'
)
Clear-Host
Write-Host "================ $Title ================" -ForegroundColor Cyan
Write-Host "1: View running processes (sorted by memory usage)"
Write-Host "2: View running processes (sorted by CPU usage)"
Write-Host "3: Search for a specific process"
Write-Host "4: View detailed information for a process"
Write-Host "5: Start a new process"
Write-Host "6: Stop a process"
Write-Host "7: View system performance counters"
Write-Host "8: Auto-refresh process list (5 second intervals)"
Write-Host "Q: Quit"
Write-Host ""
}
function Show-RunningProcessesByMemory {
Write-Host "`nRUNNING PROCESSES (TOP 20 BY MEMORY USAGE):" -ForegroundColor Green
Get-Process | Sort-Object -Property WorkingSet64 -Descending |
Select-Object -First 20 Id, ProcessName,
@{Name="Memory (MB)"; Expression={[math]::Round($_.WorkingSet64 / 1MB, 2)}},
@{Name="CPU (s)"; Expression={[math]::Round($_.CPU, 2)}},
@{Name="Threads"; Expression={$_.Threads.Count}} |
Format-Table -AutoSize
Write-Host ""
Read-Host "Press Enter to continue"
}
function Show-RunningProcessesByCPU {
Write-Host "`nRUNNING PROCESSES (TOP 20 BY CPU USAGE):" -ForegroundColor Green
Get-Process | Sort-Object -Property CPU -Descending |
Select-Object -First 20 Id, ProcessName,
@{Name="Memory (MB)"; Expression={[math]::Round($_.WorkingSet64 / 1MB, 2)}},
@{Name="CPU (s)"; Expression={[math]::Round($_.CPU, 2)}},
@{Name="Threads"; Expression={$_.Threads.Count}} |
Format-Table -AutoSize
Write-Host ""
Read-Host "Press Enter to continue"
}
function Search-Process {
$name = Read-Host "Enter process name to search for (supports wildcards)"
try {
$processes = Get-Process -Name $name -ErrorAction SilentlyContinue
if ($processes) {
Write-Host "`nPROCESSES FOUND:" -ForegroundColor Green
$processes | Select-Object Id, ProcessName,
@{Name="Memory (MB)"; Expression={[math]::Round($_.WorkingSet64 / 1MB, 2)}},
@{Name="CPU (s)"; Expression={[math]::Round($_.CPU, 2)}},
@{Name="Threads"; Expression={$_.Threads.Count}} |
Format-Table -AutoSize
} else {
Write-Host "No processes found matching '$name'" -ForegroundColor Yellow
}
} catch {
Write-Host "Error searching for process: $_" -ForegroundColor Red
}
Write-Host ""
Read-Host "Press Enter to continue"
}
function Show-ProcessDetails {
$id = Read-Host "Enter process ID to view details"
try {
$process = Get-Process -Id $id -ErrorAction Stop
Write-Host "`nDETAILED INFORMATION FOR PROCESS: $($process.ProcessName) (ID: $id)" -ForegroundColor Green
Write-Host "General Information:" -ForegroundColor Cyan
$process | Select-Object ProcessName, Id, Path, Company, Description, Product,
@{Name="Memory (MB)"; Expression={[math]::Round($_.WorkingSet64 / 1MB, 2)}},
@{Name="CPU (s)"; Expression={[math]::Round($_.CPU, 2)}},
StartTime, TotalProcessorTime |
Format-List
Write-Host "Modules Loaded:" -ForegroundColor Cyan
$process.Modules | Select-Object -First 10 ModuleName, FileName, FileVersion | Format-Table -AutoSize
Write-Host "(Showing only first 10 modules)" -ForegroundColor Yellow
Write-Host "Threads:" -ForegroundColor Cyan
$process.Threads | Select-Object -First 10 Id, StartTime, TotalProcessorTime | Format-Table -AutoSize
Write-Host "(Showing only first 10 threads)" -ForegroundColor Yellow
} catch {
Write-Host "Error retrieving process details: $_" -ForegroundColor Red
}
Write-Host ""
Read-Host "Press Enter to continue"
}
function Start-NewProcess {
$name = Read-Host "Enter the name of the program to start"
try {
Start-Process -FilePath $name
Write-Host "Successfully started '$name'" -ForegroundColor Green
} catch {
Write-Host "Error starting process: $_" -ForegroundColor Red
}
Write-Host ""
Read-Host "Press Enter to continue"
}
function Stop-ExistingProcess {
$id = Read-Host "Enter the ID of the process to stop"
try {
$process = Get-Process -Id $id -ErrorAction Stop
$confirmation = Read-Host "Are you sure you want to stop $($process.ProcessName) (ID: $id)? (Y/N)"
if ($confirmation -eq 'Y' -or $confirmation -eq 'y') {
Stop-Process -Id $id -Force
Write-Host "Successfully stopped process with ID: $id" -ForegroundColor Green
} else {
Write-Host "Operation canceled" -ForegroundColor Yellow
}
} catch {
Write-Host "Error stopping process: $_" -ForegroundColor Red
}
Write-Host ""
Read-Host "Press Enter to continue"
}
function Show-PerformanceCounters {
try {
Write-Host "`nSYSTEM PERFORMANCE:" -ForegroundColor Green
# CPU Usage
$cpuUsage = Get-Counter '\Processor(_Total)\% Processor Time' -ErrorAction Stop
$cpuValue = [math]::Round($cpuUsage.CounterSamples.CookedValue, 2)
Write-Host "CPU Usage: $cpuValue%" -ForegroundColor Cyan
# Memory Usage
$memoryInfo = Get-CimInstance Win32_OperatingSystem
$memUsed = $memoryInfo.TotalVisibleMemorySize - $memoryInfo.FreePhysicalMemory
$memTotal = $memoryInfo.TotalVisibleMemorySize
$memPercentage = [math]::Round(($memUsed / $memTotal) * 100, 2)
$memUsedGB = [math]::Round($memUsed / 1MB, 2)
$memTotalGB = [math]::Round($memTotal / 1MB, 2)
Write-Host "Memory Usage: $memUsedGB GB / $memTotalGB GB ($memPercentage%)" -ForegroundColor Cyan
# Disk I/O
$diskRead = Get-Counter '\PhysicalDisk(_Total)\Disk Read Bytes/sec' -ErrorAction Stop
$diskWrite = Get-Counter '\PhysicalDisk(_Total)\Disk Write Bytes/sec' -ErrorAction Stop
$diskReadValue = [math]::Round($diskRead.CounterSamples.CookedValue / 1KB, 2)
$diskWriteValue = [math]::Round($diskWrite.CounterSamples.CookedValue / 1KB, 2)
Write-Host "Disk Read: $diskReadValue KB/s" -ForegroundColor Cyan
Write-Host "Disk Write: $diskWriteValue KB/s" -ForegroundColor Cyan
# Network I/O
$networkInterfaces = Get-CimInstance Win32_PerfFormattedData_Tcpip_NetworkInterface
Write-Host "`nNETWORK PERFORMANCE:" -ForegroundColor Green
foreach ($interface in $networkInterfaces) {
Write-Host "Interface: $($interface.Name)" -ForegroundColor Cyan
Write-Host " Bytes Received/sec: $([math]::Round($interface.BytesReceivedPerSec / 1KB, 2)) KB/s"
Write-Host " Bytes Sent/sec: $([math]::Round($interface.BytesSentPerSec / 1KB, 2)) KB/s"
}
} catch {
Write-Host "Error retrieving performance counters: $_" -ForegroundColor Red
}
Write-Host ""
Read-Host "Press Enter to continue"
}
function Auto-RefreshProcessList {
Write-Host "Auto-refreshing process list. Press Ctrl+C to stop." -ForegroundColor Yellow
Write-Host ""
try {
for ($i = 1; $i -le 20; $i++) {
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Clear-Host
Write-Host "AUTO-REFRESH PROCESS MONITOR ($timestamp)" -ForegroundColor Cyan
Write-Host "Refresh #$i (Press Ctrl+C to stop)" -ForegroundColor Yellow
Write-Host ""
Get-Process | Sort-Object -Property WorkingSet64 -Descending |
Select-Object -First 15 Id, ProcessName,
@{Name="Memory (MB)"; Expression={[math]::Round($_.WorkingSet64 / 1MB, 2)}},
@{Name="CPU (s)"; Expression={[math]::Round($_.CPU, 2)}} |
Format-Table -AutoSize
Start-Sleep -Seconds 5
}
} catch {
Write-Host "Auto-refresh stopped: $_" -ForegroundColor Red
} finally {
Write-Host "Auto-refresh complete"
Read-Host "Press Enter to continue"
}
}
# Main program loop
do {
Show-Menu
$input = Read-Host "Please make a selection"
switch ($input) {
'1' { Show-RunningProcessesByMemory }
'2' { Show-RunningProcessesByCPU }
'3' { Search-Process }
'4' { Show-ProcessDetails }
'5' { Start-NewProcess }
'6' { Stop-ExistingProcess }
'7' { Show-PerformanceCounters }
'8' { Auto-RefreshProcessList }
'q' { continue }
default { Write-Host "Invalid option, please try again." -ForegroundColor Red; Read-Host "Press Enter to continue" }
}
} until ($input -eq 'q')
# Essential Windows 11 PowerShell Commands Reference
# Educational PowerShell Scripts
# Date: May 21, 2025
# SYSTEM INFORMATION COMMANDS
# --------------------------
# Get Windows version information
Get-ComputerInfo | Select-Object WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer
# Get hardware information
Get-CimInstance -ClassName Win32_ComputerSystem
Get-CimInstance -ClassName Win32_Processor
Get-CimInstance -ClassName Win32_PhysicalMemory | Measure-Object -Property Capacity -Sum
# Get disk information
Get-CimInstance -ClassName Win32_LogicalDisk -Filter "DriveType=3"
# Get network adapter information
Get-NetAdapter
Get-NetIPAddress
# Get installed software
Get-CimInstance -ClassName Win32_Product | Select-Object Name, Version
# See all environment variables
Get-ChildItem Env:
# FILE SYSTEM COMMANDS
# -------------------
# Navigate directories
Set-Location -Path C:\Path\To\Directory # cd equivalent
Get-Location # pwd equivalent
# List files and folders
Get-ChildItem # ls/dir equivalent
Get-ChildItem -Path C:\Windows -Filter *.exe -Recurse -File
# File operations
New-Item -Path "C:\path\newfile.txt" -ItemType File
New-Item -Path "C:\path\newfolder" -ItemType Directory
Copy-Item -Path "C:\source\file.txt" -Destination "C:\dest\file.txt"
Move-Item -Path "C:\source\file.txt" -Destination "C:\dest\file.txt"
Remove-Item -Path "C:\path\file.txt"
Remove-Item -Path "C:\path\folder" -Recurse
# Get file content
Get-Content -Path "C:\path\file.txt"
Select-String -Path "C:\path\file.txt" -Pattern "search term"
# PROCESS MANAGEMENT
# -----------------
# View all running processes
Get-Process
# Get specific process
Get-Process -Name "chrome"
# Start a process
Start-Process -FilePath "notepad.exe"
Start-Process -FilePath "notepad.exe" -ArgumentList "C:\path\file.txt"
# Stop a process
Stop-Process -Name "notepad"
Stop-Process -Id 1234
Stop-Process -Name "notepad" -Force
# SERVICE MANAGEMENT
# -----------------
# List all services
Get-Service
# Get specific service status
Get-Service -Name "wuauserv" # Windows Update service
# Start, stop, restart services
Start-Service -Name "wuauserv"
Stop-Service -Name "wuauserv"
Restart-Service -Name "wuauserv"
# USER MANAGEMENT
# --------------
# Get local users
Get-LocalUser
# Create new local user
New-LocalUser -Name "username" -Description "Description" -NoPassword
# Set user password
$Password = Read-Host -AsSecureString
Set-LocalUser -Name "username" -Password $Password
# Add user to group
Add-LocalGroupMember -Group "Administrators" -Member "username"
# REGISTRY MANAGEMENT
# ------------------
# Navigate registry
Set-Location -Path "HKLM:\SOFTWARE\Microsoft\Windows"
# Get registry values
Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion"
# Set registry value
Set-ItemProperty -Path "HKCU:\Software\MyApp" -Name "Setting" -Value "Value"
# Create registry key
New-Item -Path "HKCU:\Software\MyApp"
# NETWORKING COMMANDS
# -----------------
# Test network connection
Test-NetConnection -ComputerName "www.google.com"
Test-NetConnection -ComputerName "www.google.com" -Port 443
# Get IP configuration
Get-NetIPConfiguration
# Release/Renew DHCP
Invoke-Command {ipconfig /release}
Invoke-Command {ipconfig /renew}
# Flush DNS
Invoke-Command {ipconfig /flushdns}
# WINDOWS FEATURES
# --------------
# View all Windows features
Get-WindowsOptionalFeature -Online
# Enable/Disable Windows features
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V"
Disable-WindowsOptionalFeature -Online -FeatureName "SMB1Protocol"
# WINDOWS UPDATES
# -------------
# Check for Windows updates
Install-Module PSWindowsUpdate
Get-WindowsUpdate
# Install Windows updates
Install-WindowsUpdate
# TASK SCHEDULING
# -------------
# View scheduled tasks
Get-ScheduledTask
# Create a scheduled task
$Action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-File C:\path\script.ps1"
$Trigger = New-ScheduledTaskTrigger -Daily -At 9am
Register-ScheduledTask -Action $Action -Trigger $Trigger -TaskName "MyTask" -Description "Task description"
# Win11Demo.ps1
# Windows 11 Quick Customization Demo
# Author: Educational PowerShell Scripts
# Date: May 21, 2025
# ---------------------------------------------
# 1) LAUNCH PROGRAMS
# ---------------------------------------------
"Starting Notepad, Calculator, Paint, and the Store…"
Start-Process notepad.exe
Start-Process calc.exe
Start-Process mspaint.exe
Start-Process ms-windows-store:
# ---------------------------------------------
# 2) DARK MODE FOR APPS & SYSTEM
# ---------------------------------------------
"Enabling Dark Mode…"
$personalize = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize'
Set-ItemProperty -Path $personalize -Name AppsUseLightTheme -Value 0 -Force
Set-ItemProperty -Path $personalize -Name SystemUsesLightTheme -Value 0 -Force
# Refresh Explorer to pick up theme change
Stop-Process explorer -Force
# ---------------------------------------------
# 3) CHANGE WALLPAPER
# ---------------------------------------------
"Setting new wallpaper…"
$wallpaper = "C:\Windows\Web\Wallpaper\Windows\img0.jpg"
Set-ItemProperty -Path 'HKCU:\Control Panel\Desktop' -Name Wallpaper -Value $wallpaper
# Apply immediately
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
# ---------------------------------------------
# 4) TASKBAR ALIGNMENT (0 = left, 1 = center)
# ---------------------------------------------
"Centering your Taskbar icons…"
$taskbar = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced'
Set-ItemProperty -Path $taskbar -Name TaskbarAl -Value 1 -Force
Stop-Process explorer -Force
# ---------------------------------------------
# 5) SHOW FILE EXTENSIONS
# ---------------------------------------------
"Always show file extensions…"
Set-ItemProperty -Path $taskbar -Name HideFileExt -Value 0 -Force
Stop-Process explorer -Force
# ---------------------------------------------
# 6) SET HIGH-PERFORMANCE POWER PLAN
# ---------------------------------------------
"Switching to High Performance power plan…"
# List all plans, pick the GUID for "High performance"
$highPerf = (powercfg /L | Select-String -Pattern "High performance").ToString() \`
-replace '.*:\s*','' -replace '\s*\(.*',''
powercfg /S $highPerf
# ---------------------------------------------
# 7) MAP A NETWORK DRIVE
# ---------------------------------------------
"Mapping drive X: to \\server\share…"
# Replace \\server\share with your real path
if (-not (Test-Path X:)) {
New-PSDrive -Name X -PSProvider FileSystem -Root "\\server\share" -Persist
}
# ---------------------------------------------
# 8) ADD A STARTUP SHORTCUT
# ---------------------------------------------
"Creating a Startup shortcut for Notepad…"
$ws = New-Object -ComObject WScript.Shell
$ln = $ws.CreateShortcut("$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\Notepad.lnk")
$ln.TargetPath = "notepad.exe"
$ln.Save()
"✅ Demo script complete!"