'==========================================================================
'
'
' NAME: <MultipleComputerMouse.vbs>
'
' AUTHOR: Ed Wilson , MS
' DATE  : 5/6/2006
'
' COMMENT: <Uses a array of computer names to control query for mouse>
'1.Uses win32_pointingdevice to retrieve handedness property of mouse
'2.Uses string of computerNames to query three different computers.
'3.Uses split function to turn the string into an Array
'4.Use for...each...next to cycle throught the array.
'==========================================================================

Option Explicit 
'On Error Resume Next
dim strComputer			'target computer
dim wmiNS						'target wmi name space
dim wmiQuery				'the WMI query
dim objWMIService		'sWbemservices object
dim colItems				'sWbemObjectSet object
dim objItem					'sWbemObject
Dim strcomputers		'string of several computers
Dim arycomputers		'an array of computers

strcomputers = "localhost,127.0.0.1,loopback"
arycomputers = Split(strComputers,",")
wmiNS = "\root\cimv2"
wmiQuery = "Select Handedness from win32_pointingdevice"

WScript.Echo wmiQuery
For Each strComputer In arycomputers
WScript.Echo "Computer: " & strComputer
	Set objWMIService = GetObject("winmgmts:\\" & strComputer & wmiNS)
	Set colItems = objWMIService.ExecQuery(wmiQuery)
	
	For Each objItem in colItems
	    Wscript.Echo vbTab & "handedness: " & objItem.handedness
	Next
Next