I've written some code in C# which creates user accounts in Active
Directory.
It was my intention to create a user account and then set the "User
must change password at next logon" account property to true. This is
straightforward enough in code. What is causing me headaches though is
that I want to be able
to query this property on a user account in C# and so far I have no
ideas on how to proceed, can anyone help ?
Thanks in Advance
Rajiv Sharma
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netdir/ad/h
ow_to_specify_comparison_values.asp?frame=true
Cheers,
Joe K.
"Rajiv Sharma" <rajiv....@unitech.net> wrote in message
news:66954675.03010...@posting.google.com...
LDAP Query: (&(objectcategory=person)(objectclass=user)(pwdlastset=0))
--
Joe Richards
www.joeware.net
---
"Rajiv Sharma" <rajiv....@unitech.net> wrote in message
news:66954675.03010...@posting.google.com...
Thanks,
Joe K.
"Joe Richards [MVP]" <humore...@hotmail.com> wrote in message
news:eUFrjNetCHA.2492@TK2MSFTNGP11...
Many Thanks again
Rajiv Sharma
public bool UserMustChangePasswordOnNextLogonUNSAFE(string DomainName,
string Username)
{
bool mustchange = false;
SearchResultCollection results = FindUser(DomainName, Username);
if (results != null)
{
DirectoryEntry myDE = results[0].GetDirectoryEntry();
IADsUser userAcct = (IADsUser) myDE.NativeObject;
// Do the spurious date comparison !!!
DateTime adInternalDate = new DateTime(1601, 1, 1);
if (userAcct.PasswordLastChanged == adInternalDate)
{
mustchange = true;
}
}
return mustchange;
}
"Joe Kaplan" <ilearnedthi...@noway.com> wrote in message news:<e91uRyftCHA.2300@TK2MSFTNGP11>...
The ToFileTime and FromFileTime methods on the DateTime stucture in .NET can
be used to process these values.
I hope that helps. Someone please correct me if I got this wrong.
Joe K.
--
Joe Richards
www.joeware.net
---
"Joe Kaplan" <ilearnedthi...@noway.com> wrote in message
news:e91uRyftCHA.2300@TK2MSFTNGP11...
Rajiv
"Joe Richards [MVP]" <humore...@hotmail.com> wrote in message news:<ezI#QKrtCHA.2304@TK2MSFTNGP12>...