Page 1 of 1 1
Topic Options
#121910 - 2004-06-28 06:44 PM Extracting username info from adsi by group...
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Hi everyone

Can anybody give me some hints on how I might extract userids by group using kix, (w2k server/client). I know then how to redirect into a txt file.

Thanks

Ste.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#121911 - 2004-06-28 06:49 PM Re: Extracting username info from adsi by group...
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Code:

$GROUPNAME = "Group"

$group = GetObject("WinNT://@DOMAIN/$GROUPNAME,group")

for each $user in $group.members
if $user.class = "user"
? "Member: " $user.name
endif
next


Top
#121912 - 2004-06-28 07:00 PM Re: Extracting username info from adsi by group...
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
$groupname='"domain users"'
$textfile ='c:\group.txt'
shell 'cmd /c net group '+$groupname+' /domain >> '+$textfile
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#121913 - 2004-06-28 07:42 PM Re: Extracting username info from adsi by group...
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Thanks for the help!

Steve.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#121914 - 2004-06-28 08:20 PM Re: Extracting username info from adsi by group...
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Ps

I need to supress the zeros that are generated.

Code:
 $GROUPNAME = "Year03"

$group = Getobject("WinNT://@DOMAIN/$GROUPNAME,group")
for each $user in $group.members
if $user.class = "user"
? "Userid: " $user.name
RedirectOutput("h:\user.csv",0)
Endif
next






Steve
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#121915 - 2004-06-28 08:26 PM Re: Extracting username info from adsi by group...
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
$_ = RedirectOutput("h:\user.csv",0)
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#121916 - 2004-06-28 09:27 PM Re: Extracting username info from adsi by group...
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
There is an FAQ in the FAQ Forum about 1s and 0s..

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#121917 - 2004-06-28 09:55 PM Re: Extracting username info from adsi by group...
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
You really only need to redirect output once...

Code:

$nul = RedirectOutput("h:\user.csv",0)
$GROUPNAME = "Year03"
$group = Getobject("WinNT://@DOMAIN/$GROUPNAME,group")
for each $user in $group.members
if $user.class = "user"
? "Userid: " $user.name
Endif
next


Top
#121918 - 2004-06-29 07:29 AM Re: Extracting username info from adsi by group...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
See also the FAQ Is '?' a PRINT or NEWLINE command?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#121919 - 2004-06-29 09:08 PM Re: Extracting username info from adsi by group...
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Chris,

The redirect should also be closed. Placed after the NEXT

Code:
$nul = RedirectOutput("")


Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.061 seconds in which 0.029 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org