Improved check-gpu.ps1 for multiple GPU's (issue #30)

This commit is contained in:
Markus Fleschutz 2025-04-22 17:45:03 +02:00
parent 67dc2a2d41
commit 1e8c6ba757

View File

@ -9,7 +9,7 @@
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz, Tyler MacInnis | License: CC0
#> #>
function Bytes2String { param([int64]$Bytes) function Bytes2String { param([int64]$Bytes)
@ -29,15 +29,17 @@ try {
# TODO # TODO
} else { } else {
$Details = Get-WmiObject Win32_VideoController $Details = Get-WmiObject Win32_VideoController
$Model = $Details.Caption foreach ($GPU in $Details) {
$RAMSize = $Details.AdapterRAM $Model = $GPU.Caption
$ResWidth = $Details.CurrentHorizontalResolution $RAMSize = $GPU.AdapterRAM
$ResHeight = $Details.CurrentVerticalResolution $ResWidth = $GPU.CurrentHorizontalResolution
$BitsPerPixel = $Details.CurrentBitsPerPixel $ResHeight = $GPU.CurrentVerticalResolution
$RefreshRate = $Details.CurrentRefreshRate $BitsPerPixel = $GPU.CurrentBitsPerPixel
$DriverVersion = $Details.DriverVersion $RefreshRate = $GPU.CurrentRefreshRate
$Status = $Details.Status $DriverVersion = $GPU.DriverVersion
Write-Host "$Model GPU ($(Bytes2String $RAMSize) RAM, $($ResWidth)x$($ResHeight) pixels, $($BitsPerPixel)-bit, $($RefreshRate)Hz, driver $DriverVersion) - status $Status" $Status = $GPU.Status
Write-Host "$Model GPU ($(Bytes2String $RAMSize) RAM, $($ResWidth)x$($ResHeight) pixels, $($BitsPerPixel)-bit, $($RefreshRate)Hz, driver $DriverVersion) - status $Status"
}
} }
exit 0 # success exit 0 # success
} catch { } catch {