Thursday

C#:Active Directory:Check/Uncheck User must change password at next logon



public void SetuserHasToChangePasswordsInTheNextLoginProperty(bool userHasToChangePasswordsInTheNextLogin)
{
DirectoryEntry de = GetDirectoryObject(UserName);
if (userHasToChangePasswordsInTheNextLogin)
{
ActiveDirectoryHelper.SetProperty(de, "pwdLastSet", 0);
}
else
{
ActiveDirectoryHelper.SetProperty(de, "pwdLastSet", -1);
}
de.CommitChanges();
}

more...

No comments:

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...