#60377 - 2001-11-07 08:29 PM
Re: Need a line of ADSI/K2K Code !!!!
|
Bryce
KiX Supporter
   
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
Shawn, yea 12168737ok, 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
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 756 anonymous users online.
|
|
|