PopeKevinI
2[H]4U
- Joined
- Mar 25, 2002
- Messages
- 2,880
This is the code I'm starting with, modified from Scriptomatic 2.0
The For loop is just proof of concept. Before that, what I want to do (for starters) is echo the number of devices found. I thought I'd be able to do that using colItems.Count as I've done with other objects, but that didn't work.
edit: to be clear, I need to get the number of query results in colItems.
I know that I could use the for look and a simple x=x+1 approach, but I'd like to use something more elegant and learn the proper way of coding this.
What this is about: This script is going to make decisions based on the number of display devices reported (1,2,3, or 4) as well as the VEN and DEV codes that are the results of the query. It's a result of us having 1,500+ computers that get imaged once a year and need to have various video configurations, including two incompatible versions of ATI's CCC.
Code:
On Error Resume Next
strComputer = "."
WScript.Echo "Computer: " & strComputer
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_VideoController", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
WScript.Echo "PNPDeviceID: " & objItem.PNPDeviceID
Next
edit: to be clear, I need to get the number of query results in colItems.
I know that I could use the for look and a simple x=x+1 approach, but I'd like to use something more elegant and learn the proper way of coding this.
What this is about: This script is going to make decisions based on the number of display devices reported (1,2,3, or 4) as well as the VEN and DEV codes that are the results of the query. It's a result of us having 1,500+ computers that get imaged once a year and need to have various video configurations, including two incompatible versions of ATI's CCC.
Last edited: