#122072 - 2004-07-02 11:22 AM
set first name, last name as domain user?
|
MathiasS
Lurker
Registered: 2004-06-28
Posts: 2
|
Hi,
we create the users in our domain with a script.
So we tried to get the users first and lastname on first login if the firstname is not set.
Following script works fine, with one problem: the user needs admin rights.
Of course all users are domain users.
Is there any solution for this problem?
My code:
Code:
Dim $Filter[0]
$Filter[0]="user"
$ou = GetObject("LDAP://OU=schueler,DC=schule,DC=hh")
For Each $User In $ou
$ou.Filter = $Filter
If Ucase($User.sAMAccountName) == Ucase(@USERID)
$Found = 1
If Len($user.firstname) < 1
? "there is no firstname"
@CRLF
@CRLF
:firstname
? "firstname?"
@CRLF
Gets $NewFirstname
@CRLF
If NOT $NewFirstname
? "give firstname!"
@CRLF
? "q to quit"
? "any key - new try"
Get $x
If $x <> q
GoTo firstname
Else
Exit
EndIf
EndIf
:lastname
? "lastname?"
@CRLF
Gets $NewLastName
@CRLF
If NOT $NewLastname
? "give lastname!"
@CRLF
? "q to quit"
? "any key - new try"
Get $x
If $x <> q
GoTo lastname
Else
Exit
EndIf
EndIf
$user.firstname = $NewFirstname
$User.lastname = $NewLastName
If $User.SetInfo = 0
? "succeeds"
Else
? "error:" + @SERROR
EndIf
Else
? "there is already a firstname."
EndIf
EndIf
Next
If NOT $Found
? "User Not Found !"
Exit
EndIf
thanks for any help
Mathias
|
|
Top
|
|
|
|
#122076 - 2004-07-02 04:01 PM
Re: set first name, last name as domain user?
|
MathiasS
Lurker
Registered: 2004-06-28
Posts: 2
|
thank you
@Les: Ok. There are errors from me and things I picked from others without understanding or checking because a three weeks ago I've never heard about kix... I will change these parts.
@Bryce: Thats the idea I've missed!  Probably the only solution.
|
|
Top
|
|
|
|
#122077 - 2004-07-02 04:57 PM
Re: set first name, last name as domain user?
|
Bryce
KiX Supporter
   
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
use something as simple as this to write the information to a log file.
Code:
$logfile = "g:\kix\sandbox\username.ini"
if not readprofilestring($logfile,"Username",@userid) $Firstname = prompt("What is the spelling of your Firstname?"+@crlf) $lastname = prompt("What is the spelling of your Lastname?"+@crlf) $ = writeprofilestring($logfile,"Username",@userid,$firstname+","+$lastname) endif
function prompt($question) ? $question+": " gets $prompt endfunction
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Henriques)
and 2516 anonymous users online.
|
|
|