Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-10-29
5
Medium Priority
?
309 Views
Last Modified: 2010-04-14
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?
0
Comment
Question by:Ranidae
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
kapes earned 2000 total points
ID: 12447234
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
 
LVL 2

Author Comment

by:Ranidae
ID: 12447327
Thanks so Much Kapes!!!!!!
0
 
LVL 2

Author Comment

by:Ranidae
ID: 12447660
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
 
LVL 6

Expert Comment

by:kapes
ID: 12448093
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
 
LVL 2

Author Comment

by:Ranidae
ID: 12448235
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
It’s time for spooky stories and consuming way too much sugar, including the many treats we’ve whipped for you in the world of tech. Check it out!
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question