Page 1 of 1 1
Topic Options
#166428 - 2006-08-25 05:55 PM ADSI enable reset user acct KixForm
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL




Code:


$DefPWD = "12345678"

$_=SetConsole('Hide')

Break On
$System = CreateObject("Kixtart.System")

;KD START

;************* Form **************
$Form = $System.Form()
$Form.BackColor = 212,208,200
$Form.FormBorderStyle = 3
$Form.Height = 230
$Form.MaximizeBox = "False"
$Form.Text = "Reset User Account"
$Form.Width = 432
;**************************************

;************* UseridLabel **************
$UseridLabel = $Form.Controls.Label("UserID:", 10, 18, 50, 17)
$UseridLabel.BackColor = 212,208,200
;**************************************

;************* UserIDTextBox **************
$UserIDTextBox = $Form.Controls.TextBox("", 65, 15, 146, 20)
$UserIDTextBox.OnKeyDown = "EnterUser()"
;**************************************

;************* UserNameTextBox **************
$UserNameTextBox = $Form.Controls.TextBox("", 65, 45, 351, 48)
$UserNameTextBox.BorderStyle = 1
$UserNameTextBox.Multiline = "True"
$UserNameTextBox.ReadOnly = "True"
;**************************************

;************* AcctLockedCheckBox **************
$AcctLockedCheckBox = $Form.Controls.CheckBox("", 105, 120, 20, 21)
$AcctLockedCheckBox.BackColor = 212,208,200
$AcctLockedCheckBox.CheckAlign = 16
$AcctLockedCheckBox.Enabled = "False"
$AcctLockedCheckBox.TabStop = "False"
;**************************************

;************* DisabledCheckBox **************
$DisabledCheckBox = $Form.Controls.CheckBox("", 210, 120, 20, 20)
$DisabledCheckBox.BackColor = 212,208,200
$DisabledCheckBox.CheckAlign = 16
$DisabledCheckBox.Enabled = "False"
;**************************************

;************* PassExpiredCheckBox **************
$PassExpiredCheckBox = $Form.Controls.CheckBox("", 350, 120, 20, 20)
$PassExpiredCheckBox.BackColor = 212,208,200
$PassExpiredCheckBox.CheckAlign = 16
$PassExpiredCheckBox.Enabled = "False"
$PassExpiredCheckBox.TabStop = "False"
;**************************************

;************* UnlockButton **************
$UnlockButton = $Form.Controls.Button("Unlock/Enable Account", 65, 165, 214, 22)
$UnlockButton.TabStop = "False"
$UnlockButton.OnClick = "Unlock()"
;**************************************

;************* ResetButton **************
$ResetButton = $Form.Controls.Button("Reset Password", 300, 165, 115, 22)
$ResetButton.TabStop = "False"
$ResetButton.OnClick = "ResetPassword()"
;**************************************

;************* Label2 **************
$Label2 = $Form.Controls.Label("Account Locked", 65, 105, 88, 17)
$Label2.BackColor = 212,208,200
;**************************************

;************* Label3 **************
$Label3 = $Form.Controls.Label("Account Disabled", 180, 105, 94, 17)
$Label3.BackColor = 212,208,200
;**************************************

;************* Label4 **************
$Label4 = $Form.Controls.Label("Must Change PW", 315, 105, 98, 16)
$Label4.BackColor = 212,208,200
;**************************************

;************* ClearButton **************
$ClearButton = $Form.Controls.Button("Clear", 365, 15, 49, 21)
$ClearButton.OnClick = "Clear()"
;**************************************

;************* Label5 **************
$Label5 = $Form.Controls.Label("Account Details", 10, 53, 50, 32)
$Label5.BackColor = 212,208,200
;**************************************

;************* Label6 **************
$Label6 = $Form.Controls.Label("Default PW: "+$DefPWD, 320, 188, 90, 10)
$Label6.BackColor = 212,208,200
$Label6.FontSize = 6
;**************************************


;KD END

$userobj = 0

$Form.Show
$UserIDTextBox.SetFocus()
While $Form.Visible
$=Execute($Form.DoEvents())
Loop
Exit 1


Function EnterUser()
If $UserIDTextBox.KeyCode=13
$userobj = 0
GetUser()
EndIf
EndFunction

Function Getuser()
$userobj = getobject("WinNT://@LDOMAIN/"+$UserIDTextBox.text+",user")
if $userobj
$UserNameTextBox.Text = $userobj.FullName +" connected" + @crlf +
"Last Logon: "+ $userobj.LastLogin + @crlf +
"Password Expiration date: "+ $userobj.PasswordExpirationDate + @crlf +
" "
$AcctLockedCheckBox.Checked = $UserObj.IsAccountLocked
$DisabledCheckBox.Checked = $UserObj.AccountDisabled
$PassExpiredCheckBox.Checked = $UserObj.PasswordExpired
else
$UserNameTextBox.Text = $UserIDTextBox.text +" account not found"
endif
endfunction

Function Unlock()
if $UserObj
$SI = 0
if $UserObj.IsAccountLocked
$UserObj.IsAccountLocked = 0
$SI = 1
endif
if $UserObj.AccountDisabled
$UserObj.AccountDisabled = 0
$SI = 1
endif
if $SI = 1
$userobj.SetInfo
endif
GetUser()
endif
EndFunction


Function ResetPassword()
if $UserObj
$UserObj.PasswordExpired = 1
$userobj.setPassword($DefPWD)
$userobj.SetInfo
GetUser()
endif
Endfunction


Function Clear()
$userobj = 0
$UserNameTextBox.text = ''
$UserIDTextBox.text = ''
$AcctLockedCheckBox.Checked = 0
$DisabledCheckBox.Checked = 0
$PassExpiredCheckBox.Checked = 0
endfunction



updated to include suggestion for setfocus
added easy location for changing default PW


Edited by Radimus (2006-08-28 02:24 PM)
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#166429 - 2006-08-26 01:45 AM Re: ADSI enable reset user acct KixForm
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Radimus,
Very Nice!
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#166430 - 2006-08-26 03:16 AM Re: ADSI enable reset user acct KixForm
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
thank you... It was an early Christmas present to my helpdesk people
Top
#166431 - 2006-08-28 01:05 PM Re: ADSI enable reset user acct KixForm
ChristopheM Offline
Hey THIS is FUN
*****

Registered: 2002-05-13
Posts: 309
Loc: STRASBOURG, France
very nice but i am a bit lazy. Could you add
$UserIDTextBox.SetFocus()
after $Form.Show ?

with this line, helpdeks doesn't have to click in the textbox, the cursor is already in it !!!
_________________________
Christophe

Top
#166432 - 2006-08-28 01:40 PM Re: ADSI enable reset user acct KixForm
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Well in that case then maybe make a box to read the default password as most companies change that over time to instead of having it hard coded, or read from an .ini that Helpdesk can change.

Helpdesk should not probably be allowed to modify the working code.

Top
#166433 - 2006-08-28 02:20 PM Re: ADSI enable reset user acct KixForm
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I thought about the defalut password deal, but as it requires the user to change at next logon, and typically that is done live while the user is on the phone (for example), it was a limited liability.

I deploy the code to staff in iexpress wrappers so it is just an exe that they can click

Top
#166434 - 2006-08-29 08:49 PM Re: ADSI enable reset user acct KixForm
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Anyone know of a quick and easy AD browse for usernames??

What I envision, is a button on the above form that would open a subform, scan AD and populate a listview of names, and a textbox that you can type into and filter the listview. Doubleclick a name and pass it to the main form.

Top
#166435 - 2006-08-29 11:14 PM Re: ADSI enable reset user acct KixForm
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
nevermind, I made one...

Code:

global $arrNames[0]

Break On
$System = CreateObject("Kixtart.System")

;KD START

;************* Form **************
$ADForm = $System.Form()
$ADForm.FormBorderStyle = 3
$ADForm.Height = 435
$ADForm.MaximizeBox = "False"
$ADForm.MinimizeBox = "False"
$ADForm.Text = ""
$ADForm.Width = 195
;**************************************

;************* TextBox1 **************
$TextBox1 = $ADForm.Controls.TextBox("", 5, 5, 175, 20)
$TextBox1.OnKeyDown = "FindUser()"
;**************************************

;************* ListBox1 **************
$ListBox1 = $ADForm.Controls.ListBox("", 5, 35, 175, 330)
$listBox1.Sorted = "True"
$listBox1.OnClick = "ListBoxClicked"
$listBox1.OnDoubleClick = "ListBoxdblClicked"
;**************************************

;************* TextBox2 **************
$TextBox2 = $ADForm.Controls.TextBox("", 5, 375, 175, 20)
$TextBox2.BackColor = 212,208,200
$TextBox2.BorderStyle = 0
$TextBox2.ReadOnly = "True"
$TextBox2.TabStop = "False"
;**************************************

;************* ProgForm **************
$ProgForm = $System.Form()
$ProgForm.FormBorderStyle = 0
$ProgForm.Height = 60
$ProgForm.StartPosition = 4
$ProgForm.Text = ""
$ProgForm.TopMost = "True"
$ProgForm.Width = 300
;**************************************

;************* PBar1 **************
$PBar1 = $ProgForm.Controls.ProgressBar("PBar1", 15, 30, 267, 11)
;**************************************

;************* Label1 **************
$Label1 = $ProgForm.Controls.Label("Searching AD for Usernames", 60, 10, 170, 16)




;KD END

$ADForm.Show
LoadListBox()
$TextBox1.SetFocus()

While $ADForm.Visible
$=Execute($ADForm.DoEvents())
Loop
Exit 1

;**********************************************************************************************************************

Function LoadListBox()
if ubound($arrNames) < 1
$ProgForm.Show
$ldap="LDAP://"+@domain+"/"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")
$ou = EnumOUs($ldap, 'user')
$ProgForm.Hide

redim $arrNames[$ListBox1.ListCount]
for $element=0 to $ListBox1.ListCount - 1
$ListBox1.ListIndex = $element
$arrNames[$element] = $ListBox1.Text
next
else
$ListBox1.List = $arrNames
$listbox1.removeitem(0)
endif
$ListBox1.listindex = 0
EndFunction

Function ListBoxClicked()
$TextBox1.text = $ListBox1.Text
EndFunction

Function ListBoxdblClicked()
; insert selection action below
;
? $ListBox1.Text
;
;
$listbox1.clear
loadlistbox()
$TextBox1.text = ''
EndFunction

Function Finduser()
if $TextBox1.KeyCode=13
; insert selection action below
;
? $ListBox1.Text
;
;
$listbox1.clear
loadlistbox()
$TextBox1.text = ''
else
for $element=0 to $ListBox1.ListCount - 1
if left($ListBox1.List($element),len($TextBox1.text))=$TextBox1.text
$ListBox1.ListIndex = $element
$element = $ListBox1.ListCount
endif
next
endif
EndFunction

Function EnumOUs($LDAP, $Filter)
dim $aFilter[0], $pos, $objOU, $i, $j

if $Filter <> 'user'
$Filter = 'computer'
endif
$objOU = GetObject($LDAP)
if VarTypeName($objOU)='Object'
$aFilter[0] = $Filter
$objOU.Filter = $aFilter
for each $item in $objOU
$PBar1.Value = iif($PBar1.Value < $PBar1.Max,$PBar1.Value + 1,0) ;for progress bar only
if $item.class = $Filter
$ListBox1.AddItem($item.sAMAccountName)
$TextBox2.text = '' + $ListBox1.ListCount + ' Items found'
$i = $LDAP
endif
next
$aFilter[0] = "organizationalUnit"
$objOU.Filter = $aFilter
for each $item in $objOU
$PBar1.Value = iif($PBar1.Value < $PBar1.Max,$PBar1.Value + 1,0) ;for progress bar only
$Name = $item.Name
$pos = instrrev($LDAP,"/")
$DN = Left($LDAP,$pos) + $Name + ", " + substr($LDAP, $pos+1)
$j = EnumOUs($DN, $Filter)
if $j
$i = iif($i,$i +"|"+ $j,$j)
endif
next
endif
$EnumOUs = $i
Endfunction



Top
#166436 - 2006-08-30 02:05 AM Re: ADSI enable reset user acct KixForm
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
ok... asked and answered... all in one:


cut old code out, new improved posted below


Edited by Radimus (2006-08-30 06:36 PM)

Top
#166437 - 2006-08-30 02:32 AM Re: ADSI enable reset user acct KixForm
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Might want to move the 2nd form over a bit.

What is the User Details box about? Saw no details on my account.

Top
#166438 - 2006-08-30 02:36 AM Re: ADSI enable reset user acct KixForm
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Rad,
This is great! I am glad to see some KiXforms, and this is great tool. Thanks for posting it over at kforg too, not enough traffic over there and this should help to get things flowing.
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#166439 - 2006-08-30 03:17 AM Re: ADSI enable reset user acct KixForm
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Code:
 		$UserNameTextBox.Text =  $userobj.FullName +" connected" + @crlf +
"Last Logon: "+ $userobj.LastLogin + @crlf +
"Password Expiration date: "+ $userobj.PasswordExpirationDate + @crlf +

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

Top
#166440 - 2006-08-30 03:18 AM Re: ADSI enable reset user acct KixForm
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Quote:

Rad,
This is great! I am glad to see some KiXforms, and this is great tool. Thanks for posting it over at kforg too, not enough traffic over there and this should help to get things flowing.




It is much better now that files can be uploaded.

Glad to do it.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#166441 - 2006-08-30 06:37 PM Re: ADSI enable reset user acct KixForm
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Code:


$DefPWD = "12345678"

$userobj = 0
global $arrNames[0]


;$_=SetConsole('Hide')
Break On
$System = CreateObject("Kixtart.System")

;KD START

;************* Form **************
$Form = $System.Form()
$Form.BackColor = 212,208,200
$Form.FormBorderStyle = 3
$Form.Height = 230
$Form.MaximizeBox = "False"
$Form.Text = "Reset User Account"
$Form.Width = 432
;**************************************

;************* UseridLabel **************
$UseridLabel = $Form.Controls.Label("UserID:", 10, 18, 50, 17)
$UseridLabel.BackColor = 212,208,200
;**************************************

;************* UserIDTextBox **************
$UserIDTextBox = $Form.Controls.TextBox("", 65, 15, 146, 20)
$UserIDTextBox.OnKeyDown = "EnterUser()"
;**************************************

;************* UserNameTextBox **************
$UserNameTextBox = $Form.Controls.TextBox("", 65, 45, 351, 48)
$UserNameTextBox.BorderStyle = 1
$UserNameTextBox.Multiline = "True"
$UserNameTextBox.ReadOnly = "True"
;**************************************

;************* AcctLockedCheckBox **************
$AcctLockedCheckBox = $Form.Controls.CheckBox("", 105, 120, 20, 21)
$AcctLockedCheckBox.BackColor = 212,208,200
$AcctLockedCheckBox.CheckAlign = 16
$AcctLockedCheckBox.Enabled = "False"
$AcctLockedCheckBox.TabStop = "False"
;**************************************

;************* DisabledCheckBox **************
$DisabledCheckBox = $Form.Controls.CheckBox("", 210, 120, 20, 20)
$DisabledCheckBox.BackColor = 212,208,200
$DisabledCheckBox.CheckAlign = 16
$DisabledCheckBox.Enabled = "False"
;**************************************

;************* PassExpiredCheckBox **************
$PassExpiredCheckBox = $Form.Controls.CheckBox("", 350, 120, 20, 20)
$PassExpiredCheckBox.BackColor = 212,208,200
$PassExpiredCheckBox.CheckAlign = 16
$PassExpiredCheckBox.Enabled = "False"
$PassExpiredCheckBox.TabStop = "False"
;**************************************

;************* UnlockButton **************
$UnlockButton = $Form.Controls.Button("Unlock/Enable Account", 65, 165, 214, 22)
$UnlockButton.TabStop = "False"
$UnlockButton.OnClick = "Unlock()"
;**************************************

;************* ResetButton **************
$ResetButton = $Form.Controls.Button("Reset Password", 300, 165, 115, 22)
$ResetButton.TabStop = "False"
$ResetButton.OnClick = "ResetPassword()"
;**************************************

;************* Label2 **************
$Label2 = $Form.Controls.Label("Account Locked", 65, 105, 88, 17)
$Label2.BackColor = 212,208,200
;**************************************

;************* Label3 **************
$Label3 = $Form.Controls.Label("Account Disabled", 180, 105, 94, 17)
$Label3.BackColor = 212,208,200
;**************************************

;************* Label4 **************
$Label4 = $Form.Controls.Label("Must Change PW", 315, 105, 98, 16)
$Label4.BackColor = 212,208,200
;**************************************

;************* FindButton **************
$FindButton = $Form.Controls.Button("Find", 300, 15, 49, 21)
$FindButton.OnClick = "Find()"
;**************************************

;************* ClearButton **************
$ClearButton = $Form.Controls.Button("Clear", 365, 15, 49, 21)
$ClearButton.OnClick = "Clear()"
;**************************************

;************* Label5 **************
$Label5 = $Form.Controls.Label("Account Details", 10, 53, 50, 32)
$Label5.BackColor = 212,208,200
;**************************************

;************* Label6 **************
$Label6 = $Form.Controls.Label("Default PW: "+$DefPWD, 320, 188, 90, 10)
$Label6.BackColor = 212,208,200
$Label6.FontSize = 6
;**************************************


;************* Form **************
$ADForm = $System.Form()
$ADForm.FormBorderStyle = 3
$ADForm.Height = 435
$ADForm.MaximizeBox = "False"
$ADForm.MinimizeBox = "False"
$ADForm.Text = ""
$ADForm.Width = 195
;**************************************

;************* TextBox1 **************
$TextBox1 = $ADForm.Controls.TextBox("", 5, 5, 175, 20)
$TextBox1.OnKeyDown = "FindUser()"
;**************************************

;************* ListBox1 **************
$ListBox1 = $ADForm.Controls.ListBox("", 5, 35, 175, 330)
$listBox1.Sorted = "True"
$listBox1.OnClick = "ListBoxClicked"
$listBox1.OnDoubleClick = "ListBoxdblClicked"
;**************************************

;************* TextBox2 **************
$TextBox2 = $ADForm.Controls.TextBox("", 5, 375, 175, 20)
$TextBox2.BackColor = 212,208,200
$TextBox2.BorderStyle = 0
$TextBox2.ReadOnly = "True"
$TextBox2.TabStop = "False"
;**************************************

;************* ProgForm **************
$ProgForm = $System.Form()
$ProgForm.FormBorderStyle = 0
$ProgForm.Height = 60
$ProgForm.StartPosition = 4
$ProgForm.Text = ""
$ProgForm.TopMost = "True"
$ProgForm.Width = 300
;**************************************

;************* PBar1 **************
$PBar1 = $ProgForm.Controls.ProgressBar("PBar1", 15, 30, 267, 11)
;**************************************

;************* Label1 **************
$Label1 = $ProgForm.Controls.Label("Searching AD for Usernames", 60, 10, 170, 16)




;KD END


$UnlockButton.Enabled = "False"
$ResetButton.Enabled = "False"


$Form.Show
$UserIDTextBox.SetFocus()
While $Form.Visible
$=Execute($Form.DoEvents())
Loop
Exit 1

;**********************************************************************************************************************

Function Find()
$TextBox1.text = $UserIDTextBox.text
Clear()
$ADForm.Show
LoadListBox()
Finduser(1)
$TextBox1.SetFocus()
$rc = SENDKEYS ("^{RIGHT}")
EndFunction

Function LoadListBox()
if ubound($arrNames) < 1
$ProgForm.Show
$ldap="LDAP://"+@domain+"/"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")
$ou = EnumOUs($ldap, 'user')
$ProgForm.Hide

redim $arrNames[$ListBox1.ListCount]
for $element=0 to $ListBox1.ListCount - 1
$ListBox1.ListIndex = $element
$arrNames[$element] = $ListBox1.Text
next
else
$ListBox1.List = $arrNames
$listbox1.removeitem(0)
endif
$ListBox1.listindex = 0
EndFunction

Function ListBoxClicked()
$TextBox1.text = $ListBox1.Text
$TextBox1.SetFocus()
$rc = SENDKEYS ("^{RIGHT}")
EndFunction

Function ListBoxdblClicked()
$ADForm.Hide
$UserIDTextBox.text = $TextBox1.text
$UserIDTextBox.SetFocus()
$rc = SENDKEYS ("^{RIGHT}")
GetUser()
EndFunction

Function Finduser(optional $skip)
select
case $TextBox1.KeyCode=13 and not $skip
$ADForm.Hide
$TextBox1.text = $ListBox1.Text
$UserIDTextBox.text = $TextBox1.text
$UserIDTextBox.SetFocus()
$rc = SENDKEYS ("^{RIGHT}")
GetUser()
case $TextBox1.KeyCode=40 and not $skip and $ListBox1.ListIndex +1 < $ListBox1.ListCount
$ListBox1.ListIndex = $ListBox1.ListIndex +1
$TextBox1.text = $ListBox1.Text
$TextBox1.SetFocus()
$rc = SENDKEYS ("^{RIGHT}")
case $TextBox1.KeyCode=38 and not $skip and $ListBox1.ListIndex -1 > 0
$ListBox1.ListIndex = $ListBox1.ListIndex -1
$TextBox1.text = $ListBox1.Text
$TextBox1.SetFocus()
$rc = SENDKEYS ("^{RIGHT}")
case 1
for $element=0 to $ListBox1.ListCount - 1
if left($ListBox1.List($element),len($TextBox1.text))=$TextBox1.text
$ListBox1.ListIndex = $element
$element = $ListBox1.ListCount
endif
next
endselect
EndFunction

Function EnterUser()
If $UserIDTextBox.KeyCode=13
$userobj = 0
GetUser()
EndIf
EndFunction

Function Getuser()
$userobj = getobject("WinNT://@LDOMAIN/"+$UserIDTextBox.text+",user")
if $userobj
$UserNameTextBox.Text = $userobj.FullName +" connected" + @crlf +
"Last Logon: "+ $userobj.LastLogin + @crlf +
"Password Expiration date: "+ $userobj.PasswordExpirationDate + @crlf +
" "
$AcctLockedCheckBox.Checked = $UserObj.IsAccountLocked
$DisabledCheckBox.Checked = $UserObj.AccountDisabled
$PassExpiredCheckBox.Checked = $UserObj.PasswordExpired
$UnlockButton.Enabled = "True"
$ResetButton.Enabled = "True"
else
$UnlockButton.Enabled = "False"
$ResetButton.Enabled = "False"
Find()
endif
endfunction

Function Unlock()
if $UserObj
$SI = 0
if $UserObj.IsAccountLocked
$UserObj.IsAccountLocked = 0
$SI = 1
endif
if $UserObj.AccountDisabled
$UserObj.AccountDisabled = 0
$SI = 1
endif
if $SI = 1
$userobj.SetInfo
endif
GetUser()
endif
EndFunction


Function ResetPassword()
if $UserObj
$UserObj.PasswordExpired = 1
$userobj.setPassword($DefPWD)
$userobj.SetInfo
GetUser()
endif
Endfunction


Function Clear()
$userobj = 0
$UserNameTextBox.text = ''
$UserIDTextBox.text = ''
$AcctLockedCheckBox.Checked = 0
$DisabledCheckBox.Checked = 0
$PassExpiredCheckBox.Checked = 0
$UnlockButton.Enabled = "False"
$ResetButton.Enabled = "False"
endfunction


Function EnumOUs($LDAP, $Filter)
dim $aFilter[0], $pos, $objOU, $i, $j

if $Filter <> 'user'
$Filter = 'computer'
endif
$objOU = GetObject($LDAP)
if VarTypeName($objOU)='Object'
$aFilter[0] = $Filter
$objOU.Filter = $aFilter
for each $item in $objOU
$PBar1.Value = iif($PBar1.Value < $PBar1.Max,$PBar1.Value + 1,0) ;for progress bar only
if $item.class = $Filter
$ListBox1.AddItem($item.sAMAccountName)
$TextBox2.text = '' + $ListBox1.ListCount + ' Items found'
$i = $LDAP
endif
next
$aFilter[0] = "organizationalUnit"
$objOU.Filter = $aFilter
for each $item in $objOU
$PBar1.Value = iif($PBar1.Value < $PBar1.Max,$PBar1.Value + 1,0) ;for progress bar only
$Name = $item.Name
$pos = instrrev($LDAP,"/")
$DN = Left($LDAP,$pos) + $Name + ", " + substr($LDAP, $pos+1)
$j = EnumOUs($DN, $Filter)
if $j
$i = iif($i,$i +"|"+ $j,$j)
endif
next
endif
$EnumOUs = $i
Endfunction



Top
#166442 - 2006-08-30 09:59 PM Re: ADSI enable reset user acct KixForm
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Thanks Rad,

That fixed the data box for me.

However, I'd still move the SECONDARY find form over.
When it loads it produces odd graphic effects when over the top of the main form which also appears to do something.

Not critical, just not as appealing as it could be otherwise.

Thanks again.

Top
#166443 - 2006-08-30 10:01 PM Re: ADSI enable reset user acct KixForm
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
ok.. I don't have it going anywhere in particular... randomness is fine by me :-)


BTW, I added it to sim 132.


Edited by Radimus (2006-08-30 10:01 PM)

Top
#166444 - 2006-08-30 10:14 PM Re: ADSI enable reset user acct KixForm
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
guess some day should start back on that.
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 262 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

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