Use PowerShell to Discover Multi-Monitor Information

Summary: Microsoft Scripting Guy, Ed Wilson, talks about how to use Windows PowerShell to discover multi-monitor configuration information on your computer. 

Hey, Scripting Guy! Question Hey, Scripting Guy! I am a long time reader, but a first time writer. I have been following your blog for years. You are awesome! I have become good at navigating around various WMI classes, but I need to find information about multiple monitors that are connected to my laptop running Windows 7. Ideally, I would like to know if it is connected to only the laptop display, or if there is an added monitor. If I can also find the resolution, it would be awesome.


Hey, Scripting Guy! Answer Hello BG,

Microsoft Scripting Guy, Ed Wilson, is here. I just got off a LYNC call with my mentee. We were talking about how important our customers are to us. I told him that I simply cannot do my job properly if I do not talk to customers, hear from customers, and speak to customer groups on a regular basis. He is working on a book, and he mentioned that he misses immediate feedback from customers when he is writing. With my blog, I get feedback every day. In fact, I get an email notification when a comment is written to the blog. These comments make the blog better for us all. Also, the email sent to is really important because this is where I get many of my ideas for posts.

So BG, thank you for writing.

There are a couple of WMI classes that provide information about resolution and monitors. One of these classes is the Win32_VideoController class. I can query this by using Get-CimInstance in Windows PowerShell 3.0, or I can use Get-WmiObject in Windows 7 with the default Windows PowerShell 2.0. The command is shown here:

Get-WmiObject win32_videocontroller

Following is the command and its associated output:

Image of command output

By looking at the output, I can see that I am most interested in the caption, and in the CurrentHorizontalResolution and CurrentVerticalResolution properties. I write the query this way:

PS C:\> Get-WmiObject win32_videocontroller | select caption, CurrentHorizontalResolution, CurrentVerticalResolution

The command and its output are as follows:

Image of command output

The cool thing is that I can use a wildcard character and the alias and really shorten this command as shown here:

GWMI win32_videocontroller | select caption, Current*Resolution

So, I have discovered that I have two video controllers on my computer, but both of them are set to use the same resolution.

Well, what about monitors?

To find information about the monitors, I use the Win32_Desktopmonitor WMI class. The query is shown here:

Get-WmiObject win32_desktopmonitor

The default display shows information about the screen height and screen width. But this information, for some reason, does not appear for my laptop monitor itself. This is shown in the following image:

Image of command output

Of course, I already have some of this information from the Video Controller. So I can sort of work back and forth with this.

There is a cool WMI class on my laptop running Windows 8 (I’m not sure if it exists on Windows 7 devices). It is in the Root\WMI namespace. The class is WmiMonitorBasicDisplayParams, and it tells me if a display is active. It also tells me the capabilities of that monitor. Using the Get-CimInstance cmdlet produces a nice output (but you can also use Get-WmiObject). Here is the command:

Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorBasicDisplayParams

The command and the output are shown here:

Image of command output

The SupportedDisplayFeatures property returns another object. The easy way to look at this is to store the object in a variable, and then address it directly. This technique is shown in the following image:

Image of command output

BG, that is all there is to using Windows PowerShell to find multi-monitoring information. Join me tomorrow when I will talk about more cool Windows PowerShell stuff.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy

Comments (7)

  1. Matt Alvis says:

    I am working with some of these handy cmdlets, and would like to confirm the last example does indeed work for Windows 7. Regards

  2. Matt Alvis says:

    However, would like to note that the win32_desktopmonitor does not reflect the fact I have two monitors, whereaws get-ciminstance does…. Once again, that’s Windows 7, and one monitor is hooked via VGA – the other, using DisplayPort.

  3. Jared Grey says:

    Hi,you can get information more you can see in feature.
    Its work in window 7.

  4. Marky Mark says:

    Both win32_desktopmonitor and win32_videocontroller show only one display! That sux!

  5. Roman Kvasnicka says:

    get-wmiobject -Query ‘select * from Win32_PnPEntity where service="monitor"’ | select Name,HardwareID,PNPDeviceID

  6. Wim says:

    #simple example of setting max height of a powershell gui form
    $CalculatedHeight = $MyNumberOfElements * $SizeOfEachElement + $Padding
    $MaxHeight=(Get-WmiObject win32_videocontroller).CurrentVerticalResolution

    #first try
    $Height= if ($CalculatedHeight -gt ($MaxHeight – $Margin)) {($MaxHeight – $Margin)} else {$CalculatedHeight}
    > Error: Method invocation failed because [System.Object[]] does not contain a method named 'op_Subtraction'.

    #compare values directly perhaps
    $Height=if (($CalculatedHeight + $Margin) -gt $MaxHeight) {"BLACK MAGIC HERE"} else {$CalculatedHeight}
    > Could not compare "780" to "1080 ". Error: "Cannot convert the "System.Object[]" value of type "System.Object[]" to type "

    #ok, casting CurrentVerticalResolution to an integer then
    $MaxHeight=[int](Get-WmiObject win32_videocontroller).CurrentVerticalResolution
    > Error: Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Int32".

    #ok, I'm new at powershell so I must be missing something to be able to calculate with this result
    #if not … what's the use of this??

  7. DrewE says:

    This is great Information but what do I Need to call to find out which Monitor is where in the Overall Windows Display layout. For example I have three Monitors acting as one Desktop. Which one is the left one, the right one and Center?

Skip to main content