How do I purposefully lock out a users NT account?
I've an agreement which new users to a 'restricted' have to read and
accept/decline before they can use the network.
If they decline, then the machine logs them out, using the
ExitWindowsEx(EWX_LOGOFF, 0) API.
However, my manager has asked if we can also lock their account out
automatically too.
The simplest way I can think of locking their account is to hit heir account
3 times in succession with a random password. But my implementation of the
API doesn't work. Am I doing this the right way?
Public Function LockAccount() As Long
Dim i As Integer
Dim lngTokenHandle, lngLogonType, lngLogonProvider As Long
Dim passWord As String
lngLogonType = LOGON32_LOGON_INTERACTIVE
lngLogonProvider = LOGON32_PROVIDER_DEFAULT
passWord = "1234abcd4321"
For i = 0 To 2
LockAccount = LogonUser(frmAccept.USRname, frmAccept.DOMname,
passWord, lngLogonType, lngLogonProvider, lngTokenHandle)
Next i
End Function