Thursday

C#:Active Directory:Check/Uncheck Password never expires


public void SetPasswordNeverExpiresProperty(bool PasswordNeverExpires)
{
DirectoryEntry de = GetDirectoryObject(UserName);
if (PasswordNeverExpires)
{
ActiveDirectoryHelper.SetProperty(de, "userAccountControl",
(int)de.Properties["userAccountControl"].Value | 0x10000);
}
else
{
ActiveDirectoryHelper.SetProperty(de, "userAccountControl",
(int)de.Properties["userAccountControl"].Value ^ 0x10000);
}
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 ...