none
Fetch latslogon details from Active directory using C#.NET RRS feed

  • Question

  • We are using a website which will evaluate the user credentials from Activedirectory in a specific group.

    Now we want to create a report from AD, it should contains the list of users from that specific group and when they access the website last time.

    Below piece of code will correctly list the users available on the specific group.

    I wrote another piece code to return the lastlogon datetime for each users  in that group. But that will list the date time under 'HUMAD' domain not from that particular group.

    DirectoryEntrydeUsers =            

    newDirectoryEntry("LDAP ://  XXXXX");

    DirectorySearcherdsUsers = newDirectorySearcher(deUsers);

    dsUsers.PropertiesToLoad.Add(

    "cn");

    dsUsers.PropertiesToL

    }oad.Add(

    "SAMAccountname");

                dsUsers.Filter =

    "(&(ObjectClass=user)(memberof=g_cms_readonly))";

    vardomainContext = newPrincipalContext(ContextType.Domain);

    vargroupPrincipal = GroupPrincipal.FindByIdentity(domainContext, IdentityType.SamAccountName, g_cms_readonly);

    foreach(Principalm ingroupPrincipal.Members)

                        {

                            }

    Environment.NewLine + m.SamAccountName + "  "+ m.Name + "  "+dt+ " ";

    I use ADExplorer tool and didn't see any attributes available for that specific group to check last logon time. Using .NET, is there any way to find that?
    Thursday, February 26, 2015 8:35 PM

Answers

  • Akhil,

     This forum is dedicated to Project and Project Server, and I am not sure if your question is related to this. If yes, please elaborate.

    If no, then please post to appropriate forum. This one looks relevant. https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=csharpgeneral


    Cheers,

    Prasanna Adavi, Project MVP

    Blog:   Podcast:    Twitter:    LinkedIn:   


    Thursday, February 26, 2015 9:16 PM
    Moderator