A. The Win32_DesktopMonitor class, which is accessible through Windows Management Instrumentation (WMI), gives information about system monitors. The class is documented at " Win32_DesktopMonitor Class."

The following WMI script (showmonitors.vbs) lists all the connected monitors in my network.

strComputer = "."
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim WshShell
Set objWMIService = GetObject("winmgmts:" & "\{impersonationLevel=impersonate\}!\\" & strComputer & "\root\cimv2")
Set colMonitors = objWMIService.ExecQuery ("select * from win32_DesktopMonitor where Availability = 3")
For Each objMonitor in colMonitors
wscript.echo "Caption " & objMonitor.Caption
wscript.echo "Resolution " & objMonitor.ScreenWidth & " x " & objMonitor.ScreenHeight
wscript.echo "Availability " & objMonitor.Availability
Next

Note that the availability value specifies the monitor state. In my example, monitor 3 is in operation (the other values are documented in the previously referenced MSDN article).

To run the script, enter the command

D:\Temp>cscript showmonitors.vbs

The following is the result:

Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

Caption Dell 2407WFP (Digital)
Resolution 1920 x 1200
Availability 3