It is easy to get CPU information using the Windows Terminal app on Windows 11. This is fun.
The script below will show information about all the CPU core usage. This is a very neat trick.
$processorCounters = Get-Counter -ListSet "Processor Information" | Where-Object { $_.Paths -like "*\% Processor Time*" } | Select-Object -ExpandProperty Paths ForEach ($counterPath in $processorCounters) { $usage = (Get-Counter -Counter $counterPath).CounterSamples.CookedValue Write-Host "$($counterPath.Split("\")[-2]) : $($usage) %" } |
This is the output below. This is pretty verbose.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | PS C:\Users\Intel i5\Documents> .\cores.ps1 Processor Information(*) : 0 0 0 0 0 0 0 0 0 0 0 0 0 0 % Processor Information(*) : 100 100 100 100 100 100 100 100 100 100 100 100 100 100 % Processor Information(*) : 7.39761398032917 1.37699693793522 7.87017165151624 3.05374691794293 11.3167285734159 3.71397186152378 8.44167543419239 2.82168057472055 8.8029020266219 1.76762350322738 5.24238373747678 3.02393792639232 5.40204234010543 5.40195597223843 % Processor Information(*) : 8.13641904170914 1.55887125242794 5.159766601394 5.07685330293964 7.60654279282845 4.52013702229778 8.42592314109373 3.68618437506925 8.5547194182426 1.89449365565799 5.93713286215166 1.71892253824334 5.19173268541309 5.19360296806074 % Processor Information(*) : 124.6382461701 135.824937027708 134.59847648067 138.09321423426 133.782717893022 138.142979305627 133.758119122257 137.405305097697 131.900570844338 135.567136725935 130.470103014407 137.602530956593 133.13589952543 133.11381061913 % Processor Information(*) : 962.547094105054 208.386484290785 809.730338958478 274.871695945464 1094.52520082255 211.363434066368 756.145242997991 212.355750658228 862.323118327105 270.90242957802 773.014625059626 261.971580251272 6707.06784438769 6714.01406053072 % Processor Information(*) : 1108818.97727273 4421575.22123894 1324456.69824087 4021025 1075533.66336634 5683858.62068965 1196629.32330827 5254872.34042553 1091992.14365881 3872542.08494209 1226499.12718204 5900765.88235294 1876884.19047619 1874295.03883341 % Processor Information(*) : 166.452309778449 6.93551290743537 174.378610244089 0.990787558205053 144.654983497938 4.95393779102527 244.724526876648 1.98157511641011 155.553646638193 0.990787558205053 196.175936524601 18.824963605896 1116.6175780971 1116.6175780971 % Processor Information(*) : 1 1 1 1 1 1 1 1 1 1 1 1 0 0 % Processor Information(*) : 100 100 100 100 100 100 100 100 100 100 100 100 100 100 % Processor Information(*) : 2904 2904 2904 2904 2904 2904 2904 2904 2904 2904 2904 2904 2904 2904 % Processor Information(*) : 0 0 0 0 0 0 0 0 0 0 0 0 0 0 % Processor Information(*) : 0 0 0 0 0 0 1.42044269910434 0 0 0 0 0 0.00849755783933759 0.00849755783933759 % Processor Information(*) : 1593.82419472853 255.528894600893 953.510544444578 1023.10985425805 1579.90433276583 802.380614563894 1201.08523220965 880.928407067671 1360.16936892616 283.368618526282 1351.22088623585 223.712067257591 11512.7201190029 11518.6857741298 % Processor Information(*) : 0 0 0 0 0 0 0 0 0 0 0 0 0 0 % Processor Information(*) : 0 0 0 0 0 0 0 0 0 0 0 0 0 0 % |
This is another version of the script that will format this information in a table.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | $processorCounters = Get-Counter -ListSet "Processor Information" | Where-Object { $_.Paths -like "*\% Processor Time*" } | Select-Object -ExpandProperty Paths $coreUsages = @() ForEach ($counterPath in $processorCounters) { $coreName = $($counterPath.Split("\")[-2]) $usage = (Get-Counter -Counter $counterPath).CounterSamples.CookedValue $formattedUsage = "{0:N2}" -f $usage $coreUsages += [PSCustomObject]@{ Core = $coreName Usage = [double]$formattedUsage } } $coreUsages | Format-Table -AutoSize |
And this will give this output.
PS C:\Users\Intel i5\Documents> .\cpu.ps1 Core Usage ---- ----- Processor Information(*) 0 Processor Information(*) 100 Processor Information(*) 9.36 Processor Information(*) 8.03 Processor Information(*) 124.8 Processor Information(*) 891.93 Processor Information(*) 1027136.89 Processor Information(*) 151.72 Processor Information(*) 1 Processor Information(*) 100 Processor Information(*) 2904 Processor Information(*) 0 Processor Information(*) 2.62 Processor Information(*) 1391.32 Processor Information(*) 0 Processor Information(*) 0 Processor Information(*) 96.16 Processor Information(*) 0 Processor Information(*) 0 Processor Information(*) 100.19 Processor Information(*) 4 Processor Information(*) 414.51 Processor Information(*) 0 Processor Information(*) 1.54 Processor Information(*) 1179.39 Processor Information(*) 0 Processor Information(*) 1.54 Processor Information(*) 0.74 |
This is an interesting Powershell trick, this gives CPU core information.
Another good tip is to get the CPU speed for each core in your CPU. Powershell can manage this very well.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | $processorInfo = Get-WmiObject -Class Win32_Processor $totalCores = $processorInfo.NumberOfLogicalProcessors $baseClockSpeedMhz = $processorInfo.MaxClockSpeed $coreUsages = @() for ($coreNumber=0; $coreNumber -lt $totalCores; $coreNumber++) { if ($coreNumber -eq 0) { $coreName = "Total" } else { $coreName = "Core $($coreNumber - 1)" } $coreUsages += [PSCustomObject]@{ Core = $coreName Base_Speed_MHz = [double]$baseClockSpeedMhz } } $coreUsages | Format-Table -AutoSize |
And below is the output this will give you.
PS C:\Users\Intel i5\Documents> .\cpuspeed.ps1 Core Base_Speed_MHz ---- -------------- Total 2904 Core 0 2904 Core 1 2904 Core 2 2904 Core 3 2904 Core 4 2904 Core 5 2904 Core 6 2904 Core 7 2904 Core 8 2904 Core 9 2904 Core 10 2904 |
Get simple CPU information this way.
PS C:\Users\Intel i5\Documents> Get-CimInstance -ClassName Win32_Processor DeviceID Name Caption MaxClockSpeed SocketDesignation Manufacturer -------- ---- ------- ------------- ----------------- ------------ CPU0 Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz Intel64 Family 6 Model 165 Stepping 5 2904 LGA1200 GenuineIntel |
Another very cool Powershell trick. Get all Youtube videos in a list from a Youtube channel ID.
1 2 3 4 5 6 7 8 9 10 11 | # Define YouTube channel ID and build RSS URL $channelID = "UCXgGY0wkgOzynnHvSEVmE3A" # Replace with your desired channel ID $rssURL = "https://www.youtube.com/feeds/videos.xml?channel_id=$channelID" # Fetch and parse the XML content from the RSS feed [xml]$rssContent = (Invoke-WebRequest -Uri $rssURL).Content # Iterate through each entry and print video title ForEach ($entry in $rssContent.feed.entry) { Write-Host $entry.title } |
This really does work very well indeed.
PS C:\Users\Intel i5\Documents> .\vids.ps1 Saturday live with Wess from Appwrite | 20+ years of code How to start cloud learning journey 2023 Reading the docs can be faster than videos ๐ | @Appwrite Build fast, build in public, build with open source like @Appwrite Updates about my Learning in Masters @Appwrite is giving away 10,000$ to promote coding and open source . Last hours This will change DSA and Leetcode preparation forever | Pieces for developers React Native Authentication in 1 shot | Appwrite Backend Using Appwrite service with custom context in React Native Apple vision pro | Developers 1st impression Pieces: An Essential Tool for the Modern Developer's Toolkit Saturday Live for coders ๐ฅ What is CSR SSR SSG and ISR Let's kill all programming language | playlist intro Complete Appwrite authentication walkthrough |