Page 1 of 1 1
Topic Options
#188158 - 2008-06-11 08:05 PM LDAP Props
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Ok here I go again... Trying to identify the "user account is locked" property but can not seem to locate it.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#188159 - 2008-06-11 08:35 PM Re: LDAP Props [Re: Gargoyle]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
found it
 Quote:

User lockout uses the user's lockoutTime property. When you access Active Directory by using the LDAP provider, you can use it to determine the lockout status of the user. If it is larger than zero, the user is currently locked out. To undo the lockout, set the value to zero.

LockoutTime is cleared only when the locked-out user attempts to log on. When the lockout time has expired, but the user has not yet tried to log on, lockoutTime may be still set, although the user would be able to successfully log on at that time.

http://support.microsoft.com/kb/250873/en-us
_________________________
Today is the tomorrow you worried about yesterday.

Top
#188163 - 2008-06-11 09:24 PM Re: LDAP Props [Re: Gargoyle]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Well that is almost it... the .lockoutTime returns an object. How can I tell what can be accessed within that object? I am venturing into unknown waters here...

I have tried .lockoutTime.value and .lockoutTime.text, but get no value back from either of those
_________________________
Today is the tomorrow you worried about yesterday.

Top
#188164 - 2008-06-11 09:56 PM Re: LDAP Props [Re: Gargoyle]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
Here's a snippet that might help:
 Code:
$Members = GroupMembers(@DOMAIN, 'Domain Users', 2)
For Each $Member In $Members

  ; get specific user data
  $objUser = GetObject('WinNT://' + @DOMAIN + '/' +$Member + ',user')

  ; read flags
  $Flags = $objUser.UserFlags 

  ; if not disabled, and not Never Expires, report on expired or about to expire accounts
  If Not $objUser.AccountDisabled And Not ($Flags & 65536)
    $ExpDate = FixDate($objUser.PasswordExpirationDate)
    $Days = Int(TimeDiff('Now', $ExpDate, 'D'))
    $LStat = $objUser.IsAccountLocked
    $EStat = $objUser.PasswordExpired

I think you're looking for the $LStat value above..

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#188165 - 2008-06-11 09:59 PM Re: LDAP Props [Re: Glenn Barnas]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
But that is not with LDAP \:\) I was rewriting to go to WinNT, would still like to know how to get the "objects" available from a particular object handle.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#188166 - 2008-06-11 10:02 PM Re: LDAP Props [Re: Gargoyle]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
Ah - sorry. Too many things going on here today to focus properly.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#188186 - 2008-06-12 01:27 PM Re: LDAP Props [Re: Glenn Barnas]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 687
Loc: Maryland, USA
Good Morning,

I think the last link below will have what you are looking for. He has a VB script to list all locked out users in a domain.

http://msdn.microsoft.com/en-us/library/ms676843(VS.85).aspx
http://msdn.microsoft.com/en-us/library/cc198287.aspx
http://www.rlmueller.net/LockedUsers.htm

Hope that is what you were looking for!

Regards,

Brad V

Top
#188190 - 2008-06-12 02:39 PM Re: LDAP Props [Re: BradV]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Thanks Brad, but again they are using the WinNT provider. I was able to get the needed info with that. I was looking into using LDAP as the provider and instead of getting the "text value" I expected, I am getting an object back, and since I do not know what the members of that object are I am unable to read any of them.

What I ended up with was something like this

 Code:
$usr = GetObject(WinNT://@domain/$user)
$lock = usr.IsAccountLocked
Select
  Case $lock = 0
    $Lbl_Locked.text = "Account is NOT locked"
  Case $lock = -1
    $lbl_Locked.text = "Account is locked"
  Case 1
    $lbl_Locked.text = "Error reading account lockout"
EndSelect


To "unlock" the account I have this code

 Code:
$usr.IsAccountLocked = "FALSE"
$usr.setinfor
If @error = 0
  $lbl_Locked.text = "Account has been unlocked"
Else
  $lbl_Locked.text = "Error unlocking the account"
EndIf



What I found interesting is that everything that I have read so far says that this should be a "single value" in LDAP, when KiX reads the value it returns a Vartype of 9 (object). Hence why I have had so many problems. Like I stated it was easy enough to fix by changing the provider.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#188200 - 2008-06-12 11:03 PM Re: LDAP Props [Re: Gargoyle]
NTDOC Administrator Online   content
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
I've only briefly read the post Garg but remember that not everything that can be done with WINNT can be done with LDAP and vice-versa.

I would search the board some more as it could be one of those long 64bit integer issues or something like that.

I know the code has been done a couple of times here, but maybe as you've found they all use WinNT for it - not sure, just something more to ponder and research.

Top
#188207 - 2008-06-13 12:06 AM Re: LDAP Props [Re: Gargoyle]
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
You could downlod the portable script center from Microsoft, lots of examamples in vbscript that can easily be convertet to KiX
Scriptcenter 3.0

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1471 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.066 seconds in which 0.031 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org