-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmonitor_detection.vbs
25 lines (20 loc) · 1.02 KB
/
monitor_detection.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Set objShell = CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
' Try multiple monitor detection methods
Set activeMonitors = objWMIService.ExecQuery("SELECT * FROM Win32_DesktopMonitor WHERE Status='OK'")
Set videoControllers = objWMIService.ExecQuery("SELECT * FROM Win32_VideoController")
Set pnpMonitors = objWMIService.ExecQuery("SELECT * FROM Win32_PnPEntity WHERE Service='Monitor'")
msgbox "Active Monitors: " & activeMonitors.Count & vbCrLf & _
"Video Controllers: " & videoControllers.Count & vbCrLf & _
"PnP Monitors: " & pnpMonitors.Count
' Display details for each detection method
For Each monitor In activeMonitors
msgbox "Desktop Monitor: " & monitor.DeviceID
Next
For Each controller In videoControllers
msgbox "Video Controller: " & controller.Description & vbCrLf & _
"Resolution: " & controller.CurrentHorizontalResolution & "x" & controller.CurrentVerticalResolution
Next
For Each pnp In pnpMonitors
msgbox "PnP Monitor: " & pnp.Caption
Next