55 This PowerShell script queries GPU details and prints it.
66. EXAMPLE
77 PS> ./check-gpu
8- CPU is 30.3°C warm.
98. LINK
109 https://github.com/fleschutz/PowerShell
1110. NOTES
@@ -25,16 +24,20 @@ function Bytes2String { param([int64]$Bytes)
2524}
2625
2726try {
28- $Details = Get-WmiObject Win32_VideoController
29- $Model = $Details.Caption
30- $RAMSize = $Details.AdapterRAM
31- $ResWidth = $Details.CurrentHorizontalResolution
32- $ResHeight = $Details.CurrentVerticalResolution
33- $BitsPerPixel = $Details.CurrentBitsPerPixel
34- $RefreshRate = $Details.CurrentRefreshRate
35- $DriverVersion = $Details.DriverVersion
36- $Status = $Details.Status
37- " ✅ $Model ($ ( Bytes2String $RAMSize ) , $ResWidth x $ResHeight pixels, $BitsPerPixel bit, $RefreshRate Hz, driver $DriverVersion , status $Status )."
27+ if ($IsLinux ) {
28+ # TODO
29+ } else {
30+ $Details = Get-WmiObject Win32_VideoController
31+ $Model = $Details.Caption
32+ $RAMSize = $Details.AdapterRAM
33+ $ResWidth = $Details.CurrentHorizontalResolution
34+ $ResHeight = $Details.CurrentVerticalResolution
35+ $BitsPerPixel = $Details.CurrentBitsPerPixel
36+ $RefreshRate = $Details.CurrentRefreshRate
37+ $DriverVersion = $Details.DriverVersion
38+ $Status = $Details.Status
39+ " ✅ $Model ($ ( Bytes2String $RAMSize ) , $ResWidth x $ResHeight pixels, $BitsPerPixel bit, $RefreshRate Hz, driver $DriverVersion , status $Status )."
40+ }
3841} catch {
3942 " ⚠️ Error in line $ ( $_.InvocationInfo.ScriptLineNumber ) : $ ( $Error [0 ]) "
4043 exit 1
0 commit comments