Using the DPI class script referenced here I can get DPI scaling for my main monitor how would I also get the output from any additional monitors which may have a separate scaling factor?
Asked
Active
Viewed 2,408 times
1 Answers
1
I am using powershell 7 and i used following code:
Add-Type -AssemblyName System.Windows.Forms
$rh=[int]((Get-CimInstance -ClassName CIM_Display).ScreenHeight | Format-Table -HideTableHeaders | Out-String)
$vh=[int][System.Windows.Forms.SystemInformation]::VirtualScreen.Height
$screen_scale_factor=$rh/$vh
Better still
Add-Type -AssemblyName System.Windows.Forms
# $rh=[int]((Get-CimInstance -ClassName CIM_Display).ScreenHeight | Format-Table -HideTableHeaders | Out-String)
$rh=[int](Get-CimInstance -ClassName Win32_VideoController)[0].CurrentVerticalResolution
$vh=[int][System.Windows.Forms.SystemInformation]::VirtualScreen.Height
$screen_scale_factor=$rh/$vh
And you could iterate over VideoController array and get the same for every monitor.

hardeep
- 59