Page 1 of 1 1
Topic Options
#64094 - 2002-03-26 09:49 PM User account reset script
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Based on the COM work from the COM forum, and the XLSinputbox; here is a simple script to reset a user account to a default 123456 and require the user to change it at next logon, and unlock it if the user locked it via bad attempts.

code:
break on
setconsole("hide")
$username=XlsInputBox("Enter Username to reset","User Reset",@userid)
$reset=Getuser($username)

;*************************************************************************************
function Getuser($user)
$userobj = getobject("WinNT://@LDOMAIN/$user,user")
if $userobj
$UserObj.IsAccountLocked = 0
$UserObj.PasswordExpired = 1
$userobj.setPassword("123456")
$userobj.SetInfo
$=sendmessage("@wksta","@error - @serror")
$userobj =0
else
$=sendmessage("@wksta","$user account not found")
endif
endfunction

function XlsInputBox( $prompt, optional $title, optional $default, optional $left, optional $top, optional $type)
dim $xls
$xls = createobject("excel.application")
if $xls
$xlsInputBox = $xls.inputbox($prompt,$title,$default,$left,$top,,,2)
if not $xlsInputBox quit endif
$xls.quit
$xls = 0
endif
endfunction

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#64095 - 2002-03-28 07:40 AM Re: User account reset script
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Here is a simpler version. [Smile]

Requires Kix 4.x.

ref - http://cwashington.netreach.net/depo/AdsiFaq/unlocking_a_user_account.htm

code:
?"Enter in a Userid - e.g jdoe"
GETS $User

$UserObj = GetObject("WinNT://@LDOMAIN/$User")
If $UserObj.IsAccountLocked = -1
$UserObj.IsAccountLocked = 0
$UserObj.SetInfo
ENDIF

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

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
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.047 seconds in which 0.022 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