May 152011
I have recently come across a situation where I need to determine whether an account is locked or not.
Conveniently, the IADsUser interface provides a property that is exactly what I need !.
This little code block will return a true or false depending on whether the account is locked or not, with true representing a locked account.
var objUser = GetObject("LDAP://cn=user,ou=users,dc=example,dc=com");
var boolUsrLocked = objUser.isAccountLocked;
return boolUsrLocked;
This code has a small typo.
the object is created as objUsr (without e) and later referred to as objUser (with e)
var objUsr = GetObject(“LDAP://cn=user,ou=users,dc=example,dc=com”);
var boolUsrLocked = objUser.isAccountLocked;
return boolUsrLocked;
anyway, thanks for your site !.
Nice catch !
I’ll get that fixed now
Thanks for the visit 🙂