WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

wNT
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Unlock account with wntUserSetDat

Keywords:    Unlock account with wntUserSetDat 

Question:

I can disable and lock a user's account with wntUserSetDat("","joeuser","flags",18) but, is it possible to ENable and / or UNlock an account with this function?

Answer:

Yes, you can. And, the code fragment that you posted is dangerous. You are overwriting the flags value rather than reading the current value, modifying it and then writing the modified value back to the user account.

Do the following to modify it safely:

flags = wntUserGetDat("","joeuser","flags",0)

; Do one of the four following things by
; uncommenting it:

;flags = flags & (~2) ; turn off account disable

;flags = flags & (~16) ; turn off account lockout

;flags = flags | 2 ; turn on account disable

;flags = flags | 16 ; turn on account lockout

wntUserSetDat("","joeuser","flags",flags,0)

Article ID:   W15202
File Created: 2002:09:05:13:50:32
Last Updated: 2002:09:05:13:50:32