From e5cd798a62b8eacf2ee8815b9a2106a3800a2cce Mon Sep 17 00:00:00 2001 From: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com> Date: Mon, 15 Aug 2022 19:17:32 +0530 Subject: [PATCH] Report MaxClockSpeed in CPU (#144) * Report MaxClockSpeed in CPU * Round off to GHz --- winfetch.ps1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/winfetch.ps1 b/winfetch.ps1 index 9409fe3..6a37af4 100644 --- a/winfetch.ps1 +++ b/winfetch.ps1 @@ -687,9 +687,16 @@ function info_theme { # ===== CPU/GPU ===== function info_cpu { + $cpu = Get-CimInstance -ClassName Win32_Processor -Property Name,MaxClockSpeed -CimSession $cimSession + $cpuname = if ($cpu.Name.Contains('@')) { + ($cpu.Name -Split ' @ ')[0] + } else { + $cpu.Name + } + $cpufreq = [math]::round((([int]$cpu.MaxClockSpeed)/1000), 2) return @{ title = "CPU" - content = (Get-CimInstance -ClassName Win32_Processor -Property Name -CimSession $cimSession).Name + content = "${cpuname} @ ${cpufreq}GHz" } }