none
User and Group Provisioning to Active Directory RRS feed

Answers

  • Create user:

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.DirectoryServices;   namespace ConsoleApplication1 { class Program { static void Main(string[] args) {   string ADFullPath = "LDAP://192.168.0.10/OU=T2,OU=root,DC=admin,DC=domain,DC=com"; DirectoryEntry ouEntry = new DirectoryEntry(ADFullPath, "admin", "passw0rd", AuthenticationTypes.Secure);   for (int i = 0; i < 1; i++) { try { DirectoryEntry childEntry = ouEntry.Children.Add("CN=TESTUSER" + i, "user"); childEntry.CommitChanges(); ouEntry.CommitChanges(); childEntry.Invoke("SetPassword", new object[] { "password22" }); childEntry.CommitChanges(); } catch (Exception ex) {   }   }   } } }

    Also check this: http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-Directory-via-C


    Nosh Mernacaj, Identity Management Specialist

    Friday, July 3, 2015 4:38 PM

All replies

  • take a look here: https://msdn.microsoft.com/en-us/library/windows/desktop/ms698810%28v=vs.100%29.aspx

    Friday, July 3, 2015 1:34 AM
  •  ProvisionLDAPUser(mventry, "Test Active Directory", String.Concat("CN=", mventry["displayName"].Value), "OU=SomeOU,DC=test,DC=Test,DC=com" );

    Nosh Mernacaj, Identity Management Specialist

    Friday, July 3, 2015 1:36 PM
  • I need connection string for using AD services ?
    Friday, July 3, 2015 3:50 PM
  • This goes onto the provisioning dll.  Connection is established in the AD MA. No need for connection strings.

    Nosh Mernacaj, Identity Management Specialist


    Friday, July 3, 2015 3:56 PM
  • Yes that's right when we are provisioning user using FIM  but How can we connect to AD from custom application, let say our requirement is to provisioned user from source(sql) to AD without using FIM by using C#, is this making sense sir ?
    Friday, July 3, 2015 4:19 PM
  • Since your post is under FIM i assumed this is related to FIM. For that you need to use accountmanager and directoryservices libraries. Plenty of examples on the web.

    Nosh Mernacaj, Identity Management Specialist


    Friday, July 3, 2015 4:22 PM
  • Thank You sir.

    Friday, July 3, 2015 4:24 PM
  • Create user:

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.DirectoryServices;   namespace ConsoleApplication1 { class Program { static void Main(string[] args) {   string ADFullPath = "LDAP://192.168.0.10/OU=T2,OU=root,DC=admin,DC=domain,DC=com"; DirectoryEntry ouEntry = new DirectoryEntry(ADFullPath, "admin", "passw0rd", AuthenticationTypes.Secure);   for (int i = 0; i < 1; i++) { try { DirectoryEntry childEntry = ouEntry.Children.Add("CN=TESTUSER" + i, "user"); childEntry.CommitChanges(); ouEntry.CommitChanges(); childEntry.Invoke("SetPassword", new object[] { "password22" }); childEntry.CommitChanges(); } catch (Exception ex) {   }   }   } } }

    Also check this: http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-Directory-via-C


    Nosh Mernacaj, Identity Management Specialist

    Friday, July 3, 2015 4:38 PM