Skip to main content
added 417 characters in body
Source Link

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.

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

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.

Source Link

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