Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
C

caiena

@caiena
About
Posts
16
Topics
12
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Get all users from a group in ad using directorysearcher
    C caiena

    how do i change the filter to only give me users in my group i tryied memberOf='CN=GMDPortal,OU=IT,OU=ADM,DC=corp,DC=com' but it does not work i need to use a directorysearcher because i need to set search.PageSize = 4000; i have 3,000 users in this group public static ArrayList GetAllADDomainUsers() { string domainpath = @"LDAP://DC=corp,DC=com"; ArrayList allusers = new ArrayList(); DirectoryEntry searchRoot = new DirectoryEntry(domainpath); DirectorySearcher search = new DirectorySearcher(searchRoot); search.Filter = "(&(objectCategory=person)(objectClass=user)(memberOf='CN=GMDPortal,OU=IT,OU=ADM,DC=corp,DC=com' )(!userAccountControl:1.2.840.113556.1.4.803:=2))"; search.PropertiesToLoad.Add("samaccountname"); search.PropertiesToLoad.Add("distinguishedName"); search.PropertiesToLoad.Add("description"); search.PropertiesToLoad.Add("displayName"); search.PropertiesToLoad.Add("pwdLastSet"); search.PropertiesToLoad.Add("whenChanged"); search.ReferralChasing = ReferralChasingOption.All; search.PageSize = 4000; SearchResult result; SearchResultCollection resultCol = search.FindAll(); user ousr = new user(); if (resultCol != null) { for ( int counter = 0; counter < resultCol.Count; counter++) { result = resultCol[counter]; if (result.Properties.Contains("distinguishedName")) { ousr = new user(); ousr.dn = (string)result.Properties["distinguishedName"][0]; try { ousr.Description = (string)result.Properties["description"][0]; } catch (Exception er) { ousr.Description = " "; } try { ousr.DisplayName = (string)result.Properties["displayName"][0]; } catch (Exception er) { ousr.DisplayName = (string)result.Properties["samaccountname"][0]; } try

    C# com question

  • using DirectorySearcher to get Group members
    C caiena

    how could i change this code to use the DirectorySearcher to get me all members in the group the reason i want to use the DirectorySearcher is because i can set the PageSize so i can get more than 1,000 users currently all these groups have over 2,000 users public static ArrayList testGetUsers() { ArrayList excludeGroups = new ArrayList(); ArrayList users = new ArrayList(); DirectoryEntry group; excludeGroups.Add("CN=GMDPortal,OU=IT,OU=ADM,DC=corp,DC=ad,DC=ejhospital,DC=com"); excludeGroups.Add("CN=GService,OU=SysServices,DC=corp,DC=ad,DC=ejhospital,DC=com"); excludeGroups.Add("CN=GTrain,OU=Training,OU=ADM,DC=corp,DC=ad,DC=ejhospital,DC=com"); excludeGroups.Add("CN=GITLevSvcs,OU=LevSvcs,OU=IT,OU=ADM,DC=corp,DC=ad,DC=ejhospital,DC=com"); foreach (string DEgroup in excludeGroups) { group = new DirectoryEntry("LDAP://" + DEgroup); foreach (object dn in group.Properties["member"]) { users.Add(dn); } } return users; }

    C# com

  • get all users in a group from AD
    C caiena

    how would i query AD for all user's in a group (note i have 2400 users in the group i want to quesy) in Csharp

    C# csharp database

  • AD group
    C caiena

    is there a method that i can query Ad in group lets say i wanted to get them is groups of 500 until i get all of them example

    C# com help question

  • AD group
    C caiena

    i am running the method to get all my users in a group my only problem is it only get the first 1000 users i have 2500 users in this group how do i change the capacity to 3000 public static ArrayList getUsers() { ArrayList excludeGroups = new ArrayList(); ArrayList users = new ArrayList(); excludeGroups.Add("CN=GMDPortal,OU=IT,OU=ADM,DC=corp,DC=ad,DC=ejhospital,DC=com"); foreach (string DEgroup in excludeGroups) { DirectoryEntry group = new DirectoryEntry("LDAP://" + DEgroup); foreach (object dn in group.Properties["member"]) { users.Add(dn); } } return users; }

    C# com help question

  • Delete A and Prt Records from DNS
    C caiena

    i'm trying to manage my dns server i'm have a csharp program that deletes computer from the domain after the have not loged on in 90 day and i wanted to also delete them from DNS so i need to delete A and Prt records for the computer i am removing from Active Directory

    C# question csharp

  • Delete A and Prt Records from DNS
    C caiena

    How do i Delete A and Prt Records from DNS in csharp?

    C# question csharp

  • Mouse Scheme in windows
    C caiena

    I am looking for a way to change the mouse scheme in windows and keep in changed even after my program exits

    C#

  • enumerate local group membership on a member server
    C caiena

    how can i enumerate all groups members in all groups on a member server

    C# sysadmin question

  • computer share rights
    C caiena

    what i am really looking to do is check the total right a users has to a share do i have to find out all the groups they are in and get all the rights for each group and calulate it my self or is there and easier way?

    C#

  • computer share rights
    C caiena

    i am looking for a way to list all the share on a given computer and also list all groups on users who have access and what access they have

    C#

  • Active directory Users
    C caiena

    i user this code to get all users on the domain but it only returns me 1,000 users the problem is i have over 3,000 users in my domain what can i do to get the entire user list from AD public static ArrayList GetAllADDomainUsers() { string domainpath = @"LDAP://DC=tshospital,DC=com"; ArrayList allUsers = new ArrayList(); DirectoryEntry searchRoot = new DirectoryEntry(domainpath); DirectorySearcher search = new DirectorySearcher(searchRoot); search.Filter = "(&(objectClass=user)(objectCategory=person))"; search.PropertiesToLoad.Add("samaccountname"); SearchResult result; SearchResultCollection resultCol = search.FindAll(); if (resultCol != null) { for (int counter = 0; counter < resultCol.Count; counter++) { result = resultCol[counter]; if (result.Properties.Contains("samaccountname")) { allUsers.Add((String)result.Properties["samaccountname"][0]); //allUsers.Add(result.GetDirectoryEntry()); } } } return allUsers; }

    C# com windows-admin help

  • get last logon time
    C caiena

    i am not sure how i would do this but i am trying to modify the code below to take a directory entry and check the last logon time on eache domain controler currently it does a directory sear on each domain controler and it becomes unresponsive (this method is being call 1 time for each user on my domain i have over 3,000 users and i already have a DictionaryEntry object created public DateTime LastLogon(string user, string domain) { DirectoryContext context = new DirectoryContext(DirectoryContextType.Domain, domain); DateTime latestLogon = DateTime.MinValue; string servername = null; bool processed = false; DomainControllerCollection dcc = DomainController.FindAll(context); foreach (DomainController dc in dcc) { DirectorySearcher ds; //System.Console.WriteLine(dc.Name); bool exist = false; using (dc) using (ds = dc.GetDirectorySearcher()) { ds.Filter = String.Format("(sAMAccountName={0})", username); ds.PropertiesToLoad.Add("lastLogon"); dc.GetDirectoryEntry ds.SizeLimit = 1; // this search is killing my server SearchResult sr = ds.FindOne(); if (sr != null) { DateTime lastLogon = DateTime.MinValue; if (sr.Properties.Contains("lastLogon")) { exist = true; lastLogon = DateTime.FromFileTime((long)sr.Properties["lastLogon"][0]); } if (DateTime.Compare(lastLogon, latestLogon) > 0) { latestLogon = lastLogon; servername = dc.Name; } } } } return latestLogon; }

    COM sysadmin

  • active directory users
    C caiena

    i tried this method to see if i could figure out if the user was disabled but i get and error i just wanted to see if i would get a 0x1 if the user account is not disbled and a 0x2 if it was public void Disable(string userDn) { try { DirectoryEntry user = new DirectoryEntry(userDn); int val = (int)user.Properties["userAccountControl"].Value; \\ get the error on the above line user.Properties["userAccountControl"].Value = val | 0x2; //ADS_UF_ACCOUNTDISABLE; } catch (System.DirectoryServices.DirectoryServicesCOMException E) { //DoSomethingWith --> E.Message.ToString(); } }

    C# windows-admin

  • active directory users
    C caiena

    can someone put a code snip here that i can use to determin if a adusers is disabled

    C# windows-admin

  • Active directory Question
    C caiena

    i have a program that authenticated users with Active directory how do i query AD to find out when is the last time a user was authenicated i trided using last logon time but this is only updated when they log on to the computer not when the authenticate

    C# question database windows-admin
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups