ADSI: Disable / Enable an Account
9/24/2004 8:15:44 AM
Manage your domain, and active directory. This code snip disables and enables an account in the Windows domain.
' function to enable or disable the account of a user. ' accepts true or false to enable or disable an acccount. Dim strDomain Dim strUser
strDomain = "myDomain" strUser = "Username"
Sub DisableEnableAccount(blnStatus) On Error Resume Next Set oUser = GetObject(strDomain & "/" & strUser) oUser.AccountDisabled = blnStatus oUser.SetInfo Set oUser = Nothing If Err <> 0 Then strServerError = strServerError & "Status change failed!" & vbcrlf End If End Sub
|