Page 1 of 1 1
Topic Options
#60366 - 2001-11-07 02:17 PM Need a line of ADSI/K2K Code !!!!
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
If anybody has done this before (Shawn, Bryce,someone else ?=) ... I need to copy a domain user 8 times, with different names of course, and it must work on an NT Box with the adsi runtimes installed !

Anyone ?

tia
Jochen

[ 07 November 2001: Message edited by: jpols ]

_________________________



Top
#60367 - 2001-11-07 03:57 PM Re: Need a line of ADSI/K2K Code !!!!
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
there seems to be no straight copy option for the WinNT: interface .copyhere seems to only work for NDS and AD.

But you can easly create a new user, and use a template user to fill in the information..... give me a little bit to write the code

Top
#60368 - 2001-11-07 04:02 PM Re: Need a line of ADSI/K2K Code !!!!
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
knew it would be one of you ....

Shawn was actually crawling through the ADSI SDK , but right now have to take his kidz to school (we had a chat as usual)

Big thanx in advance goes out to Houston and Toronto !

I love this board !

J.

_________________________



Top
#60369 - 2001-11-07 04:05 PM Re: Need a line of ADSI/K2K Code !!!!
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
By the way,

It can also be non WinNT: interface ...
If there's no (easy) way, I can use also my W2K Notebook.

J.

_________________________



Top
#60370 - 2001-11-07 04:12 PM Re: Need a line of ADSI/K2K Code !!!!
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
I am off to work my self, where i can pick this up again with my proper tools

here was what i was planning to write.

New UDF called UserCreate
New UDF called UserCopy

UserCopy UDF will need GroupAdd, GroupMembers and UserCreate UDF's to get all of the correct information in place. Plus copy the things like "password never expires", "user can not change password", profile path, logon script, ..... into the new account.

Bryce

Top
#60371 - 2001-11-07 04:13 PM Re: Need a line of ADSI/K2K Code !!!!
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
are you on a AD or a Domain?
Top
#60372 - 2001-11-07 04:16 PM Re: Need a line of ADSI/K2K Code !!!!
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
...

pure NT Domain environment (ALL trusts us )

J.

_________________________



Top
#60373 - 2001-11-07 06:51 PM Re: Need a line of ADSI/K2K Code !!!!
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
hey Bryce,

What's the delay my friend ? Jochen and I are on on ICQ chat and we're anxiously awaiting another masterpeice ! You usually whip these things off in half-an-hour !

-Shawn

Top
#60374 - 2001-11-07 07:27 PM Re: Need a line of ADSI/K2K Code !!!!
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
sorry

I got to work, and they are wanting me to do some work! of all things!!!

Bryce

Top
#60375 - 2001-11-07 07:33 PM Re: Need a line of ADSI/K2K Code !!!!
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Bryce,

You got ICQ @ work ?

-Shawn

Top
#60376 - 2001-11-07 07:38 PM Re: Need a line of ADSI/K2K Code !!!!
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
10-4 houston !

Important stuff first !

J.

_________________________



Top
#60377 - 2001-11-07 08:29 PM Re: Need a line of ADSI/K2K Code !!!!
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Shawn, yea 12168737

ok,

here is the UserCreate() UDF

code:

Function UserCreate($target,$user,OPTIONAL $rightstouse)
;UserCreate Function
;
;Syntax:
; UserRename(<Domain/computer>,<userid>,[rights to use])
; <domain/computer> = the domain or computer you want to create a new account in
; <userid> = the name of the account to create
; [rights to use] = optional user name and password used to make the account
;
;Examples:
; ;This will create a user account called "thing1" in the local domain
; UserCreate(@domain,"Thing1")
;
; ;This will create a user account called thing2 on the workstation
; ;beanbag in the kixtart domain
; usercreate("kixtart/beanbag","thing2")
;
; ;This will create a user account called thing3 on the workstation
; ;beanbag in the kixtart domain, using the local Administrator account
; usercreate("kixtart/beanbag","thing2","beanbag\administrator|password")

if $rightstouse
$rightstouse = split($rightsToUse,"|")
if ubound($rightstouse) <> 1 exit(1) endif
? $rightstouse[0]
? $rightstouse[1]

if instr($target,"/") <> 0
$target = getobject("WinNT:").OpenDSObject("WinNT://$target,computer",$rightstouse[0],$rightstouse[1], 2)
if @error <> 0 and vartype($target) <> 9 exit(@error) endif
else
$target = getobject("WinNT:").OpenDSObject("WinNT://$target",$rightstouse[0],$rightstouse[1],2)
if @error <> 0 and vartype($target) <> 9 exit(@error) endif
endif
else
if instr($target,"/") <> 0
$target = getobject("WinNT://$target,computer")
if @error <> 0 and vartype($target) <> 9 exit(@error) endif
else
$target = getobject("WinNT://$target")
if @error <> 0 and vartype($target) <> 9 exit(@error) endif
endif
endif

$user = $target.create("user","$user")
if @error <> 0 and vartype($user) <> 9 exit(@error) endif

$user.setinfo
exit(@error)
endfunction



Top
Page 1 of 1 1


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

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.069 seconds in which 0.03 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