Update check-gpu.ps1

This commit is contained in:
Markus Fleschutz 2022-10-29 17:46:41 +02:00
parent a2d2aaa932
commit 2de3ecc59c

View File

@ -5,7 +5,6 @@
This PowerShell script queries GPU details and prints it. This PowerShell script queries GPU details and prints it.
.EXAMPLE .EXAMPLE
PS> ./check-gpu PS> ./check-gpu
CPU is 30.3°C warm.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -25,16 +24,20 @@ function Bytes2String { param([int64]$Bytes)
} }
try { try {
$Details = Get-WmiObject Win32_VideoController if ($IsLinux) {
$Model = $Details.Caption # TODO
$RAMSize = $Details.AdapterRAM } else {
$ResWidth = $Details.CurrentHorizontalResolution $Details = Get-WmiObject Win32_VideoController
$ResHeight = $Details.CurrentVerticalResolution $Model = $Details.Caption
$BitsPerPixel = $Details.CurrentBitsPerPixel $RAMSize = $Details.AdapterRAM
$RefreshRate = $Details.CurrentRefreshRate $ResWidth = $Details.CurrentHorizontalResolution
$DriverVersion = $Details.DriverVersion $ResHeight = $Details.CurrentVerticalResolution
$Status = $Details.Status $BitsPerPixel = $Details.CurrentBitsPerPixel
"$Model ($(Bytes2String $RAMSize), $ResWidth x $ResHeight pixels, $BitsPerPixel bit, $RefreshRate Hz, driver $DriverVersion, status $Status)." $RefreshRate = $Details.CurrentRefreshRate
$DriverVersion = $Details.DriverVersion
$Status = $Details.Status
"$Model ($(Bytes2String $RAMSize), $ResWidth x $ResHeight pixels, $BitsPerPixel bit, $RefreshRate Hz, driver $DriverVersion, status $Status)."
}
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1