here is an easy question, is there a function in vbscript to find the largest value out of a set of numbers. I have been trying to use the Ubound function but I am not having luck here is my usage:
when I echo the function I don't get a value. I would think at least I would get "l"
Code:
Function pickmailstore(strexgbox)
dim colItems
dim strComputer
dim objItem
dim i, j, k, l
strComputer = strexgbox
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & _
"\ROOT\MicrosoftExchangeV2")
Set colItems = objWMIService.ExecQuery _
("Select * from Exchange_Mailbox")
arrTotal = Array(i,j,k,l)
i = 0
j = 0
k = 0
l = 0
On Error Resume Next
For Each objItem in colItems
if objItem.StoreName = "Store1" then
i = i + 1
Elseif objItem.StoreName = "Store2" then
j = j + 1
Elseif objItem.StoreName = "Store3" then
k = k + 1
Elseif objItem.StoreName = "Store4" then
l = l + 1
End if
Next
return Ubound(arrTotal,1)
end Function
when I echo the function I don't get a value. I would think at least I would get "l"