1

I have been trying to run

wmic path Win32_VideoController get VideoModeDescription

it gives me 1920 x 1080 which is good. I change the resolution to test it and it still returns the same thing.

Does anybody know why?

I have the first screen set to 1360 x 768

The second screen is set to 1600 x 900

enter image description here

2 Answers 2

4

As stated at https://stackoverflow.com/questions/7967699/get-screen-resolution-using-wmi-powershell-in-windows-7

PS> Add-Type -AssemblyName System.Windows.Forms
PS> [System.Windows.Forms.Screen]::AllScreens


BitsPerPixel : 32
Bounds       : {X=0,Y=0,Width=1280,Height=800}
DeviceName   : \\.\DISPLAY1
Primary      : True
WorkingArea  : {X=0,Y=0,Width=1280,Height=770}

BitsPerPixel : 32
Bounds       : {X=1280,Y=0,Width=1920,Height=1200}
DeviceName   : \\.\DISPLAY2
Primary      : False
WorkingArea  : {X=1280,Y=0,Width=1920,Height=1170}
3
  • See edit. It doesn't work when you change the resolution
    – user867621
    Jan 10, 2017 at 17:37
  • Is that still the case if you close and reopen PowerShell? Jan 10, 2017 at 20:11
  • Note, that the returned value may be incorrect if the Windows display scaling is not 100%. To make it more robust the returned values must be multiplied by the scale factor. There are examples on the net how to get the scale factor from PowerShell. Sep 12, 2019 at 7:37
3

I found a way in powershell.

"Background {0}x{1}" -f [System.Windows.Forms.SystemInformation]::PrimaryMonitorSize.Width,[System.Windows.Forms.SystemInformation]::PrimaryMonitorSize.Height
2
  • This line may require issuing Add-Type -AssemblyName System.Windows.Forms before you can use it
    – Mikhail
    Jul 11, 2018 at 7:49
  • Note, that the returned value may be incorrect if the Windows display scaling is not 100%. To make it more robust the returned values must be multiplied by the scale factor. There are examples on the net how to get the scale factor from PowerShell. Sep 12, 2019 at 7:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.