====== PowerShell ====== By default Windows 10 and 11 comes with PS 5.1. You can get more modern PowerShell with winget: winget install --id Microsoft.Powershell --source winget that's all. You can check which versions are available with winget search Microsoft.PowerShell ===== How to run new PowerShell ===== New PowerShell will be installed additionally to existing PS. In Terminal after restart you will find new profile: * Windows PowerShell - old profile, PS 5.1 * PowerShell - new profile, PS 7.* ===== How to find PowerShell version ===== You can always find which PS version you run by running get-host ===== How to analyze system performance with PowerShell ===== Check who uses CPU: Get-Process | Sort-Object -Descending CPU | Select-Object -First 20 Check who uses memory: Get-Process | Sort-Object WorkingSet64 -Descending | Select-Object Name, @{Name='Memory (MB)';Expression={[math]::Round($_.WorkingSet64/1MB,2)}} | Select-Object -First 15 Quick memory overview (data in kilobytes): Get-WmiObject Win32_OperatingSystem | Select-Object TotalVisibleMemorySize, FreePhysicalMemory Calculate free memory percentage: $os = Get-WmiObject Win32_OperatingSystem $pctFree = [math]::Round(($os.FreePhysicalMemory / $os.TotalVisibleMemorySize) * 100, 2) Write-Host "Memory Utilization: $pctFree% Free" Get 50 last messages from system EventLog: Get-EventLog -LogName System -EntryType Error, Warning -Newest 50 Show uptime (old Windows versions): (New-TimeSpan -Start (Get-CimInstance Win32_OperatingSystem).LastBootUpTime -End (Get-Date)) ===== Working with files and folders ===== [[software:os:windows:powershell:files|How to work with files and folders]]