Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - help with for next loop

Reply
 
Old 01-07-2009   #1 (permalink)
zerbie45


 
 

help with for next loop

hello guys

I have a script that enumerate users that are members of a given
group.
what I need to do is to log this information in a single line. of
course with this for next loop I'm going to get as many lines as
users.

Is there a way I can get this data into a single line (or
variable ?) ?
The point is, this information must be written in the event log of a
server and I would like to have a single entry per group, instead of a
log entry per member.

I hope it's clear and there is a simple way to work around this.

thanks and regards,
zz


For Each objUser in objGroup.Members
sho.LogEvent 4, objUser.AdsPath
Next

My System SpecsSystem Spec
Old 01-07-2009   #2 (permalink)
Al Dunbar


 
 

Re: help with for next loop


<zerbie45@xxxxxx> wrote in message
news:744b1305-c873-4af1-ac7e-534b91938864@xxxxxx
Quote:

> hello guys
>
> I have a script that enumerate users that are members of a given
> group.
> what I need to do is to log this information in a single line. of
> course with this for next loop I'm going to get as many lines as
> users.
>
> Is there a way I can get this data into a single line (or
> variable ?) ?
> The point is, this information must be written in the event log of a
> server and I would like to have a single entry per group, instead of a
> log entry per member.
>
> I hope it's clear and there is a simple way to work around this.
>
> thanks and regards,
> zz
>
>
> For Each objUser in objGroup.Members
> sho.LogEvent 4, objUser.AdsPath
> Next
try this:

result = ""
For Each objUser in objGroup.Members
result = result & " " & objUser.AdsPath
Next
sho.LogEvent 4, result

/Al


My System SpecsSystem Spec
Old 01-08-2009   #3 (permalink)
zerbie45


 
 

Re: help with for next loop

On Jan 7, 1:54*pm, "Al Dunbar" <aland...@xxxxxx> wrote:
Quote:

> <zerbi...@xxxxxx> wrote in message
>
> news:744b1305-c873-4af1-ac7e-534b91938864@xxxxxx
>
>
>
>
>
Quote:

> > hello guys
>
Quote:

> > I have a script that enumerate users that are members of a given
> > group.
> > what I need to do is to log this information in a single line. of
> > course with this for next loop I'm going to get as many lines as
> > users.
>
Quote:

> > Is there a way I can get this data into a single line (or
> > variable ?) ?
> > The point is, this information must be written in the event log of a
> > server and I would like to have a single entry per group, instead of a
> > log entry per member.
>
Quote:

> > I hope it's clear and there is a simple way to work around this.
>
Quote:

> > thanks and regards,
> > zz
>
Quote:

> > For Each objUser in objGroup.Members
> > sho.LogEvent 4, objUser.AdsPath
> > Next
>
> try this:
>
> * * result = ""
> * * For Each objUser in objGroup.Members
> * * * * result = result & " " & objUser.AdsPath
> * * Next
> * * sho.LogEvent 4, result
>
> /Al- Hide quoted text -
>
> - Show quoted text -
thanks al, that works like a charm ;-)

regards,
zz
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
loop? General Discussion
I might be out of the loop but... General Discussion
loop through all ad objects PowerShell
Do Loop Vista General
Log-In Loop Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46