Query all monitors on a computer?

lkubler 41 Reputation points
2020-10-22T18:06:23.083+00:00

Hi,

I'm trying to figure out how to determine how many and what size monitors are connected to a computer running remotely at home, preferably using PowerShell at this moment. Following a Hey Scripting Guys blog post I've hit upon two approaches using wim32, wim32_VideoController and Wim32_DesktopMonitor. These are nice but they don't list all monitors on a system. Almost all of my users have two monitors at home.

Here's the simple script I'm using:
Get-WmiObject -Class "win32_videocontroller" -Namespace "root\CIMV2" -ComputerName $CompName
Get-WmiObject -Class "win32_desktopmonitor" -ComputerName $CompName

I can deduce the size of the monitor from the screen height/width or horizontal/vertical resolution depending which win32 class I am running.

My problem is that it is only returning information on 1 of the 2 monitors.

Any thoughts on how to get it to return all of the monitors attached to the system? Or, is there a better way to get this information that I haven't seen yet?

Thanks in advance!

Windows for business | Windows Server | User experience | PowerShell
{count} votes

2 answers

Sort by: Most helpful
  1. SethWH 436 Reputation points
    2020-10-22T18:40:06.773+00:00
    0 comments No comments

  2. Anonymous
    2020-10-23T09:08:36.917+00:00

    Hi,

    This command will return all the monitors for you

    Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorBasicDisplayParams  
    

    Use PowerShell to Discover Multi-Monitor Information
    https://devblogs.microsoft.com/scripting/use-powershell-to-discover-multi-monitor-information/

    Best Regards,
    Ian

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.