Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Pull multiple monitor resolutions with VB Script

$
0
0

Hey guys,

I've just started getting into the more (what I consider)  complex elements of IT, and I am currently trying to configure BGinfo to work for some computers we use at work.

I am trying to get the utility to display the resolutions of multiple monitors (these computer will have 2-3 monitors).

It should look something like:

Monitor 1: 1920 * 1080

Monitor 2: 1920 * 1080

The BGInfo utility runs a VBScript and this is what I have written so far (I have only just started learning Visual Basic at uni so some posts have PowerShell scripts which appear similar but I can't work them out.

The code I have so far (which only displays 1 display even though I currently only have 2)

'Gets details of monitors and returns them '1/09/13 strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colVidControllers = objWMIService.ExecQuery("Select * FROM Win32_VideoController") iCount=1 For Each objVidController in colVidControllers sMonitors = "Monitor "& iCount &": "& objVidController.CurrentHorizontalResolution &" * " & objVidController.CurrentVerticalResolution &" @ " & objVidController.CurrentrefreshRate &"hz" &vbcrlf &" " icount = icount+1 Next wscript.echo sMonitors

'This will not be a message once I have confirmed it works

I can't post links because my account isn't verrified yet. But if you search "fc2479b5-6cc1-490d-a6a3-d18a2e233655" you can see the answer  that I have mainly used to build this code, and I just don't know why it isn't looping for the 2nd monitor.

Hopefully someone can shed some light on this.

Regards

Cal


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>