I can find plenty of code on the internet on how to check whether an account is locked out or not, and how to unlock an account, but no code on how to lock an active directory account with C# code.
Some say it is prohibited for security reasons, some say its possible.
My code for unlocking is easy.
Can it be done, and if yes, how?
DirectoryEntry deResult = result.GetDirectoryEntry();
deResult.Properties["LockOutTime"].Value = 0;