active-directory

How do I enumerate through Active Directory Schema attributes?

I'm trying to enumerate through the Active Directory schema and don't think I'm seeing all the attributes. Could someone take a look and tell me where I'm going wrong? objRoot = new DirectoryEntry("LDAP://" + serverName + ":" + port + "/RootDSE"); strSchemaNamingContext = objRoot.Properties[ "schemaNamingContext"].Value.ToString(); ob...

Replicate Directory Changes permission in AD

Anybody knows how to check whether a user has give permission to Replicate Directory Changes in Active Directory using C# ? ...

Is there a .NET class that can parse CN= strings out of LDAP?

I've got a string that I'm fetching from LDAP for Active Directory group membership and I need to parse it to check if the user is a member of the AD group. Is there a class that can parse this for me? Example: CN=Foo Group Name,DC=mydomain,DC=com ...

Grails find / findAll operation won't work?

Hello all, I'm trying to build a Grails application which can do LDAP lookups. I've been following a few guides (link text and some others) but to no end I'm afraid. Relevant source code: From config.groovy: ldap { directories { dir1 { url = "ldap://dc01" base = "ou=someou,dc=check,dc=nl" userDn = "cn=A...

How do I determine if "DirectoryEntry" found my user?

I am using this simple method of finding a user in the current domain, that works for all users that 'exist' but I can't find any way to determine if the user does not exist. string userLDAP = @"MYDOMAIN/username"; string path = "WinNT://" + userLDAP ; DirectoryEntry root = new DirectoryEntry(path, null, null, AuthenticationTypes.Secure...

Sharepoint 2007: User name changed in ActiveDirectory. Old name still shown at top right of portal page.

I now have 2 users whose names are not correctly displayed in the 'welcome' menu at the top right of the page. The first user married and her surname changed. The new name was entered in ActiveDirectory but her maiden name is still displayed. In the second case, a LAN id was reallocated to a new department member. The name of the prev...

directoryservices.directorysearcher loop has error A column named 'cn' already belongs to this datatable

I have a function that searches AD for members of various groups. If I remove the loop, I don't get the error "A column named 'cn' already belongs to this datatable", however, I need to iterate through each OU. Function getCOMDLNames(ByVal searchStr As String) As DataTable Dim MySearchRoot As DirectoryEntry = New DirectoryEntry("pat...

PowerShell: Script failing becuase AD objects have not replicated soon enough

I have a script that creates two groups, a hand full of folders, and sets permissions on those folders. In my testing environment all of these processes work without issue but in my production environment I run into a problem. Setting the permissions on the folders fail since the groups I created have not replicated through all 8 of my d...

How to get total number of authentication operation ( login ) from Active Directory ?

We have a SharePoint site that authenticate using active directory in which user authentication is checked in active directory ... Is there any way to know from active directory how much each user log in or make authentication ? ...

PowerShell, is it possible to translate SID to ntaccount if you are not part of the domain ?

I have this powershell code. $securityidentifier = new-object security.principal.securityidentifier $sid $user = ( $securityidentifier.translate( [security.principal.ntaccount] ) ) This code works only on a computer which is in the same domain as the user whose SID I would like to translate to ntaccount. Is it possible to translate ...

Ad DirectorySearcher limited to 1k rows

IS there any way to get the AD searcher to return more than 1k rows, or to get it to return the results in 1k pages? I need to do a test on all 45k users in our domain. Code looks like this: DirectorySearcher search = new DirectorySearcher( entry ); search.Filter = "(&(objectClass=user))"; search.SizeLimit = 100...

LDAP query to return all groups in specified OU

I am trying to update my filter currently appled to the People Picker in SharePoint (WSS). I am using stsadm to set the filter. Something like... stsadm -o setproperty -url http://webserver:39770 -pn peoplepicker-searchadcustomfilter -pv "(&(userAccountControl=512)(objectCategory=person)(objectClass=user)(memberOf=cn=All Users Group,...

How do i detect changes in a object?

I have this app that loops thru my AD and I would like it to notify me on changes. IE if someone changed their email, a user was added and so on. I was thinking of checksum DirectoryEntry object that gets the root AD object with all its children but i cant wrap my head around it. DirectoryEntry entry = new DirectoryEntry("LDAP://"...

Detecting dead accounts and cleaning them from a SharePoint site

Hello I've been asked to create a solution which detects the dead accounts and cleans it up from a SharePoint site. I found a code snippet here (in the comments) which checks each user against the AD and cleans up the account. But the LDAP details are hardcoded in the code. What happens if i want to detect it dynamically and check the ...

Delete User from AD Group

Hey, I am trying to delete a user from an Active Directory group via code. Getting the helpful error of: Exception has been thrown by the targe of an invocation" Trace: Stack Trace: at System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args) at Active_Directory.RemoveUserFromGroup(String sInUs...

Check if a object is the same

Im doing some queries to a active directory, building up my own Dictionary to contain name, phone and email per user. then i store user to a file, something like this: domain\groupt\group\user;<checksum> where path before ; is the unique id for the user (a user can be in different groups so i have to track that) and <checksum> is .GetH...

Custom Attribute in ASP.NET for Page_Load

Hi, I have an ASP.NET 3.5 Site where, in some places, I am checking if the currently logged on Active Directory user is in a certain AD Security Group. In the Page_Load I'm doing something like this: if (isInADGroup(UserGUID)) { //proceed } Now I was wondering, couldn't I just create a Custom Attribute, like some of MVC's securit...

How to enumerate per-Forest Active Directory domains in C# ?

This code enumerate Active Directory domains, if the mahine on which is running is part of the forest. public static ArrayList EnumerateDomains() { ArrayList alDomains = new ArrayList(); Forest currentForest = Forest.GetCurrentForest(); DomainCollection myDomains = currentForest.Domains; foreach (Domain objDomain in my...

Microsoft Security Compliance Manager

I'd like to provide some background before I pose my question so please, bear with me. I have come across Microsoft's Security Compliance Manager. It's rather new to me and as I understand so far, one can download EC (enterprise) or SSLF (specialized security, limited function) security "baseline" GPOs for implementation in Active Dire...

Single sign-on ActiveDirectory and J2EE

Scenario: We sell J2EE(JBoss+SpringSecurity) software to large corporation which mostly use ActiveDirectory Our J2EE(JBoss) software can be hooked up to ActiveDirectory, however it requires Roles addition into ActiveDirectory i.e. cn=esp_administrator,cn=Roles,o=company,o=com As per my understanding, JBoss will need an account to "bind...