#85242 - 2002-08-21 02:44 PM
Re: Kixforms: Manage User Details - Here`s MUD in your eye !
|
Chris S.
MM club member
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
To Jooel's point, you may want to check the account to see if the "Password Never Expires" flag is set. See my post on Find Expired NT Accounts Using ADSI for a method of checking for this flag.
|
Top
|
|
|
|
#85244 - 2002-08-21 04:40 PM
Re: Kixforms: Manage User Details - Here`s MUD in your eye !
|
Richie19Rich77
Seasoned Scripter
Registered: 2002-08-16
Posts: 624
Loc: London, England
|
Ok Here is my script, was posted before but made some changes.
Richard Farthing
code:
; Used to hide the command window when complied into an .exe using kixcrypt.exe and kixforms ; Set at the top so that is it the first command used SETCONSOLE("hide")
; Created by Richard Farthing ; Created on "15th August 2002" ; ; REQUIRES: ; KIXTART 4.10 - Kix32.exe in %windir%\system32 ; KIXFORMS BUILD 21 - kixforms.dll in %windir%\system32 and registered with "regsvr32 kixforms.dll" ; An active directory enabled machine
; Version $VERSION = "V1.1"
; Enable Logging (1 = enabled and 0 = disabled) $LOGGING = 1
; Name of Program : Key User Scripts ; ; Use of the Program ; ; This program is intened to allow key users (apart of the account operator group) ; It will allow them to do the following ; ; 1) Reset a given users password to the string set in the variable $PASSWORD ; ; 2) Unlock a locked account
BREAK ON ; enables canceling of the script without auto rebooting. ; DEBUG ON ; uncomment this to enable debuging
; SET Variables $FILE_SERVER = "fileprint" $PASSWORD = "aa123456" $NOTAUTHORISED ="\\$FILE_SERVER\keyuser$\notauthorised.csv" ;file 1 $RUNLOG = "\\$FILE_SERVER\keyuser$\runlog.csv" ;file 2 $UNLOCKLOG = "\\$FILE_SERVER\keyuser$\unlocklog.csv" ;file 3 $PASSWORDLOG = "\\$FILE_SERVER\keyuser$\passwordlog.csv" ;file 4
; Authorise the user $AUTH = CreateObject("Kixtart.Form") ; Create a form called $AUTH $AUTH.Caption = "Authorising @USERID, Please Wait" $AUTH.ScaleWidth = 475 $AUTH.ScaleHeight = 75 $AUTH.FontSize = 12 $AUTH.FontName = "Arial" $AUTH.PrintXY(30,30,"Please Wait......") $AUTH.Center $AUTH.show
IF ingroup("Account Operators") = 1
$= $AUTH.MsgBox("You are Authorised to run this program", "Authorised") $AUTHORISED = "YES"
ELSE $= $AUTH.MsgBox("You are NOT Authorised to run this program", "NOT Authorised") $AUTHORISED = "NO"
IF $LOGGING = 1 $NUL=Open(1,$NOTAUTHORISED,5) $NUL=writeline (1,"@USERID,@DATE,@TIME,$AUTHORISED" + Chr(13) + Chr(10)) $NUL=CLOSE(1) ENDIF quit() endif $AUTH = 0 ;Close the form called $AUTH
; Runlog IF $LOGGING = 1 $NUL=Open(2,$RUNLOG,5) $NUL=writeline (2,"@USERID,@DATE,@TIME,$AUTHORISED" + Chr(13) + Chr(10)) $NUL=CLOSE(2) ENDIF
; Form Vars $FORM = CreateObject("Kixtart.Form") ; Create form called $FORM $FORM.Caption = "Password Reset $VERSION - Written by Richard Farthing" $FORM.ScaleHeight = 215 $FORM.ScaleWidth = 425 $FORM.FontName = "Arial" $FORM.FontSize = 9 $FORM.Center
$FRABANNER = $FORM.PictureBox $FRABANNER.BackColor = $FORM.RGB(255,255,255) $FRABANNER.Height = 75 $FRABANNER.Left = 8 $FRABANNER.Top = 10 $FRABANNER.Width = 410
$FRADETAILS = $FORM.Frame("Details") $FRADETAILS.Height = 120 $FRADETAILS.Left = 8 $FRADETAILS.Top = 85 $FRADETAILS.Width = 410
$CMDEXIT = $FRADETAILS.CommandButton("Exit!") $CMDEXIT.FontSize = 12 $CMDEXIT.Top = 85 $CMDEXIT.Width = 129 $CMDEXIT.Left = 272 $CMDEXIT.HEIGHT = 22 $CMDEXIT.OnClick = "quit()"
$TXTUSERNAME = $FRADETAILS.TextBox $TXTUSERNAME.Height = 25 $TXTUSERNAME.Left = 104 $TXTUSERNAME.Top = 24 $TXTUSERNAME.Text = "" $TXTUSERNAME.Width = 161
$CMDFINDUSER = $FRADETAILS.CommandButton("Find User!") $CMDFINDUSER.Default = 1 ; True $CMDFINDUSER.FontSize = 12 $CMDFINDUSER.Left = 272 $CMDFINDUSER.Top = 24 $CMDFINDUSER.Width = 129 $CMDFINDUSER.HEIGHT = 22 $CMDFINDUSER.OnClick = "cmdFindUser_Click()"
$LABEL_USERNAME = $FRADETAILS.Label $LABEL_USERNAME.Caption = "Username:" $LABEL_USERNAME.Height = $TXTUSERNAME.Height $LABEL_USERNAME.Width = 75 $LABEL_USERNAME.Left = $TXTUSERNAME.Left - $LABEL_USERNAME.Width $LABEL_USERNAME.Top = $TXTUSERNAME.Top
$CMDRESET_PASSWORD = $FRADETAILS.CommandButton("Reset Password") $CMDRESET_PASSWORD.Default = 0 ; True $CMDRESET_PASSWORD.FontSize = 12 $CMDRESET_PASSWORD.Left = 104 $CMDRESET_PASSWORD.Top = 85 $CMDRESET_PASSWORD.Width = 129 $CMDRESET_PASSWORD.HEIGHT = 22 $CMDRESET_PASSWORD.Enabled = 0 ; Disabled / False $CMDRESET_PASSWORD.OnClick = "Reset_Password()"
$CMDUNLOCK = $FRADETAILS.CommandButton("Unlock Account") $CMDUNLOCK.Default = 0 ; True $CMDUNLOCK.FontSize = 12 $CMDUNLOCK.Left = 104 $CMDUNLOCK.Top = 58 $CMDUNLOCK.Width = 129 $CMDUNLOCK.HEIGHT = 22 $CMDUNLOCK.Enabled = 0 ; Disabled / False $CMDUNLOCK.OnClick = "Unlock_Account()"
; Draw on the banner $FRABANNER.FontSize = 16 $FRABANNER.FontSize = 16 $FRABANNER.ForeColor = 1 $FRABANNER.PrintXY(50,7,"Client Server - Password Reset") $FRABANNER.FontSize = 12 $FRABANNER.FontBold = 1 $FRABANNER.PrintXY(110,35,"Welcome @USERID") $FRABANNER.FontBold = 0 $FRABANNER.FontSize = 10 $FRABANNER.ForeColor = $FORM.RGB(0,100,100)
DIM $STRUSERNAME DIM $STRUSERPATH
$FORM.Show $TXTUSERNAME.SetFocus
WHILE $FORM.Visible $=Execute($FORM.DoEvents) LOOP
$FORM = 0 ;Close the form called $FORM
EXIT 1
FUNCTION cmdFindUser_Click()
DIM $WAIT $WAIT = CreateObject("Kixtart.Form") ; Create form called $WAIT $WAIT.Caption = "One moment please..." $WAIT.ScaleWidth = 400 $WAIT.ScaleHeight = 75 $WAIT.FontSize = 12 $WAIT.FontName = "Arial" $WAIT.PrintXY(30,30,"Searching for User, one moment please...") $WAIT.Center DIM $USERACCOUNT,$adsGroup IF $TXTUSERNAME.Text = "" $= $FORM.MsgBox("You must specify a username before clicking Find.", "Username invalid") else IF $TXTUSERNAME.Text = "administrator" $= $FORM.MsgBox("You are not allowed to reset this password.", "Username invalid") else IF $TXTUSERNAME.Text = "rf.admin" $= $FORM.MsgBox("You are not allowed to reset this password.", "Username invalid") else IF $TXTUSERNAME.Text = "tr.admin" $= $FORM.MsgBox("You are not allowed to reset this password.", "Username invalid") $TXTUSERNAME.Text = $STRUSERNAME EXIT Sub ELSE $STRUSERNAME = $TXTUSERNAME.Text ENDIF $WAIT.Show $STRUSERPATH = "WinNT://dcserve1/$STRUSERNAME,User" $STRUSERPATH2 = "WinNT://dcserve2/$STRUSERNAME,User" $USERACCOUNT = GetObject($STRUSERPATH) IF Not $USERACCOUNT ; User does not exist $= $FORM.MsgBox("A user called (" + $TXTUSERNAME.Text + ") does not exist.", "Username invalid") ELSE ; User exists so bind to it $USERACCOUNT.GetInfo $CMDRESET_PASSWORD.Enabled = 1 ; Enable the reset password button $CMDFINDUSER.Enabled = 0 ; Disable the finduser button IF $USERACCOUNT.IsAccountLocked
$CMDUNLOCK.Enabled = 1 ; Enable the unlock button $CMDRESET_PASSWORD.Enabled = 0 ; disable the reset password button ENDIF ENDIF $FORM.Refresh $TXTUSERNAME.SetFocus
ENDFUNCTION
FUNCTION Unlock_Account()
$WAIT = CreateObject("Kixtart.Form") ; Create form called $WAIT $WAIT.Caption = "One moment please..." $WAIT.ScaleWidth = 400 $WAIT.ScaleHeight = 75 $WAIT.FontSize = 12 $WAIT.FontName = "Arial" $WAIT.PrintXY(30,30,"Unlocking Account, one moment please...") $WAIT.Center $WAIT.Show DIM $USERACCOUNT ; APPEND to $UNLOCKLOG IF $LOGGING = 1 $USERNAME = $TXTUSERNAME.Text $NUL=Open(3,$UNLOCKLOG,5) $NUL=writeline (3,"@USERID,$USERNAME,@DATE,@TIME" + Chr(13) + Chr(10)) $NUL=CLOSE(3) ENDIF ; Unlock the account $USERACCOUNT = GetObject($STRUSERPATH) $USERACCOUNT.GetInfo $USERACCOUNT.IsAccountLocked = 0 $USERACCOUNT.SetInfo $= $FORM.MsgBox("The user (" + $STRUSERNAME + ") has been unlocked.", "User enabled") $WAIT = 0 ; close the form called $WAIT $USERACCOUNT = 0 $FORM.Refresh $CMDEXIT.SetFocus $CMDUNLOCK.Enabled = 0 ; Disable the unlock button reset_password()
ENDFUNCTION
FUNCTION Reset_Password()
$WAIT = CreateObject("Kixtart.Form") ; Create form called $WAIT $WAIT.Caption = "One moment please..." $WAIT.ScaleWidth = 400 $WAIT.ScaleHeight = 75 $WAIT.FontSize = 12 $WAIT.FontName = "Arial" $WAIT.PrintXY(30,30,"Resetting Password, one moment please...") $WAIT.Center $WAIT.Show DIM $USERACCOUNT ; APPEND to $PASSWORDLOG IF $LOGGING = 1 $USERNAME = $TXTUSERNAME.Text $NUL=Open(4,$PASSWORDLOG,5) $NUL=writeline (4,"@USERID,$USERNAME,@DATE,@TIME" + Chr(13) + Chr(10)) $NUL=CLOSE(4) ENDIF ; Reset the pasword on the account $USERACCOUNT = GetObject($STRUSERPATH) $USERACCOUNT.GetInfo $USERACCOUNT.setpassword("$PASSWORD") $USERACCOUNT.put("PasswordExpired", 1) $USERACCOUNT.setinfo $USERACCOUNT = GetObject($STRUSERPATH2) $USERACCOUNT.GetInfo $USERACCOUNT.setpassword("$PASSWORD") $USERACCOUNT.put("PasswordExpired", 1) $USERACCOUNT.setinfo $= $FORM.MsgBox("The password for user (" + $STRUSERNAME + ") has been Reset to aa123456.", "Password Reset") $WAIT = 0 ; close the form called $WAIT $USERACCOUNT = 0 $FORM.Refresh $CMDEXIT.SetFocus $CMDRESET_PASSWORD.Enabled = 0 ; Disable the reset password button $FORM.Refresh
ENDFUNCTION
|
Top
|
|
|
|
#85246 - 2002-08-21 05:23 PM
Re: Kixforms: Manage User Details - Here`s MUD in your eye !
|
Bonji
Starting to like KiXtart
Registered: 2001-09-28
Posts: 169
Loc: Virginia
|
I'm creating my script for a Windows 2000 domain and when I set an account where the password never expires to User must change password, then it basically is ignoring the change password setting and leaves it disabled. I will address the issue in my code, however I'm not aware of any situation where an account is set to not expire and you can have the User must change password enabled. Is this correct? Am I missing something?
Thanks, Ben http://www.rgcweb.org:90
|
Top
|
|
|
|
#85248 - 2002-08-21 07:31 PM
Re: Kixforms: Manage User Details - Here`s MUD in your eye !
|
Bonji
Starting to like KiXtart
Registered: 2001-09-28
Posts: 169
Loc: Virginia
|
Pete,
I will probably keep that feature in for myself (keep the safer setting the default action). However, to remove that feature you just need to delete/comment out the following 3 lines in the Function cmdSetPassword_Click()
$adsUser.PasswordExpired = 1 $adsUser.SetInfo chkPasswordExpired.Value = 1
I may add this as an Option to be set after starting the script through an Options button on the form. I'll wait until I have one or two more options like this to set.
Thanks, Ben http://www.rgcweb.org:90 - User Manager Script
|
Top
|
|
|
|
#85249 - 2002-11-15 02:27 AM
Re: Kixforms: Manage User Details - Here`s MUD in your eye !
|
MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Update our site with the latest KixForms 2.9 release. Also we put the link www.kixforms.freeuk.com on our "Links to Favorite Sites". greetings.
btw: the source of this tool is also reachable from the mainpage of our site. Simple click on "Shawn Tassie". [ 15. November 2002, 02:29: Message edited by: MCA ]
|
Top
|
|
|
|
#85250 - 2002-11-15 05:20 AM
Re: Kixforms: Manage User Details - Here`s MUD in your eye !
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
M,
The link you have under my name points to a much out-of-date version of Kixforms. The latest is Version 2.1.2 Build 36 and its available at the Kixforms web site:
http://www.kixforms.freeuk.com/Assets/Files/KiXforms_212.zip
This link will obviously change over releases - not too sure how you want to deal that one out ... and big thanks for hosting this stuff on your web site !
-Shawn
|
Top
|
|
|
|
#85251 - 2002-11-15 01:48 PM
Re: Kixforms: Manage User Details - Here`s MUD in your eye !
|
MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear Shawn,
Thanks for your feedback. We will put the latest one on our site. The problem with changing filenames isn't so big. We point to the download page. greetings.
btw: we suggest to modify the link on first reaction. Now it points to the old release, which is out of date. [ 15. November 2002, 13:53: Message edited by: MCA ]
|
Top
|
|
|
|
#85255 - 2002-11-15 02:31 PM
Re: Kixforms: Manage User Details - Here`s MUD in your eye !
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Ben,
Little concerned about the WTS Section of it..
In Active Directory, you can assign a drive to the user's homedir (we typically) use H:.. This should follow suit.
Thanks,
Kent
|
Top
|
|
|
|
#85256 - 2002-11-15 02:35 PM
Re: Kixforms: Manage User Details - Here`s MUD in your eye !
|
MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Shawn,
With the feedback from Infopop it shouldn't be possible, but now we see indeed a download of its value. Indeed with 32 votes we had 5 stars. With 4 stars we will sleep also very well. greetings.
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
1 registered
(Allen)
and 466 anonymous users online.
|
|
|