How to find display resolution using Powershell?

Powershell offers a quick and easy way to find out the display resolution of a computer. You could find the actual display resolution and the scaled display resolution of a local or remote computer. Let us review the process that we can use to find the display resolution of a monitor through Powershell.

Powershell command to find the scaled resolution of a monitor

The scaled resolution is different than the actual resolution of the screen. The actual resolution is also called as the native resolution. However, scaled resolution or resolution scaling is a technique that can be used to reduce the native resolution for more optimum display performance. Generally, the scaled resolution is good to be used at 83 percent of the native resolution.

Depending on whether you need to find the scaled resolution or native resolution, the Powershell commands and directives will change.

You can find scaled resolution on a computer with the help of these two commands:

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

Both these commands need to be typed on the Powershell command shell. You can launch the Powershell environment by typing the ‘pwsh’ command on the search bar of the Windows menu. Or, you could type the ‘pwsh’ command within the command prompt.

You can also bring up Powershell through Windows —–>Settings—–>Apps—–_>Powershell

The command output of these combination Powershell directives is displayed hereunder in the screen capture:

This Powershell command is designed to give the scaled resolution for all the screens connected to the computer. In my case, this is the output for the single screen. You can notice that the scaled resolution of 1536×864 pixels is lower than the actual or native resolution on Windows of 1920×1080 pixels.

Another quick way to check the scaled resolution of monitor connected to the computer is with the command given below:

“Background {0}x{1}” -f [System.Windows.Forms.SystemInformation]::PrimaryMonitorSize.Width,[System.Windows.Forms.SystemInformation]::PrimaryMonitorSize.Height

The command output of this Powershell directive is a concise display resolution of the background. This is equivalent to the scaled resolution on the computer. The command output of the Background directive is displayed hereunder in the screen capture.

Use WMIObject to find native display resolution on a computer

WMI Object class can be used to find the native display resolution on a computer. Win32_VideoController is the WMI Object class that can be used to find the native resolution of a local or remote computer.

The command that can be used for find native resolution of a computer through Powershell is:

(Get-WmiObject -Class Win32_VideoController).VideoModeDescription

The command output will contain the native resolution and color depth on the monitor. The command output of the WMI Object class is displayed hereunder:

You can validate the fact that the native resolution on the computer is 1920 x 1080 pixels and the scaled resolution is 1536 x 864 pixels only. The scaled resolution is almost 80% of the native resolution. Resolution scaling on the computer’s display has been done for better performance and display experience. Resolution scaling is automatically done and managed by the operating system.

Use CimInstance to find native resolution of a computer

Powershell’s CimInstance can be used to find the native resolution of a computer. The following CimInstance directive can be used for fetching the display resolution of a local or remote computer:

Get-CimInstance CIM_VideoController | Select SystemName, CurrentHorizontalResolution, CurrentVerticalResolution

The command output of the CimInstance class is displayed in the screen shot below:

You can notice that the native resolution of 1920 x 1080 pixels have been properly displayed by the CimInstance class.

Summary

In this Powershell document, we learned how to find the native display resolution and scaled display resolution using different methods. For connecting to remote computers through Powershell, we suggest using the PSExec command for Powershell remoting.