VBScript to echo entries in an array in a single message box.

Hi everyone,

Here's the situation:
My VBScript calls all user names up from a specific ou on my server. It places all of these in an array.  I need to be able to echo all entries in this array to a single message box.

Here's what works so far:

Dim UsersInOU(500)
Set objOU = GetObject("LDAP://" & UserOUPath)
i = 0
objOU.Filter = Array("user")
      For Each objUser In objOU
            UsersInOU(i) = objUser.Name
            i = i + 1
            X = i
      Next
For Y = 0 To X
wscript.echo Y  & " - " & UsersInOu(Y) & Vbcr
Y = Y + 1
Next

2 problems occur:  One- it echoes in increments of 2.. (0,2,4,6,8... ) skipping all odd numbers and it puts each in it's own pop up box.  I need it to show up as a list so that a user can then select the # that matches the user to work on and we can't be skipping every second entry either.  

Can anyone help?
LVL 2
RanidaeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kapesCommented:
Dim UsersInOU(500)
Set objOU = GetObject("LDAP://" & UserOUPath)
i = 0
objOU.Filter = Array("user")
     For Each objUser In objOU
          UsersInOU(i) = objUser.Name
          i = i + 1
          X = i
     Next
Dim strTemp : strTemp = ""

For Y = 0 To X
strTemp =  strTemp & Y  & " - " & UsersInOu(Y) & Vbcr
Next
wscript.echo strTemp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RanidaeAuthor Commented:
Thanks so Much Kapes!!!!!!
0
RanidaeAuthor Commented:
Kapes... if you get this... what are the odds of having the script echo the UsersInOu in columns, max of 20 per column, cuz when there are more than fit on the screen, it doesn't show them all.
0
kapesCommented:
it would be bit complex to put it in vertical column...
I can give you in horizontal column of 5...


For Y = 0 To X
if (Y mod 5) = 0 then
strTemp =  strTemp & Y  & " - " & UsersInOu(Y) & Vbcrlf
else
strTemp =  strTemp & Y  & " - " & UsersInOu(Y) & " " 
end if
Next
wscript.echo strTemp
0
RanidaeAuthor Commented:
WHAT IF
instead of wscript.echo I used:

UserID = inputbox("These are the users in the selected group" & strTemp & "What user requires management? (Enter User # or click N to see next screen)","Users")

Have it display 30 names at a time

Then if the user clicks N... it does the same with the next 30 so on so forth until all names have been displayed or user has selected one?

I'm only getting 48 users outputed with what you just now posted and in some of the OUs there are 150 users.

Thanks for your time on this.... it is hugely apreciated.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 2000

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.