.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

DirectoryServices

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :.NET Framework
 

I need to return the OU container a group is in.

e.g. OU=HR,OU=Group,OU=TFS,DC=mycompany,DC=coml

Is this possible with directory sevices?




View Complete Post


More Related Resource Links

System.DirectoryServices NOT available

  

I have simply copied a page from a VS2005 project to a VS2010 project, and it will not work.

NO code-behind, just a simple Page_Load function in the .aspx page.

and okay, since this editor complete f's up a cut and paste from VS, I will type it all out....wonderful!

 

<script runat="server">

protected void Page_Load(object sender, EvnetArgs e)

{

   System.DirectoryServices.DirectoryEntry ...

}

</script>

This is really all you need to see.

The System.DirectoryServices is not available in intellisense and gives an error if I try to run this.

I have added the reference to my VS project - no go.

I have added a reference as an @Import at the top of the page - no go.

All other System classes appear to be available, but not DirectoryServices, so anyone know the secret handshake to get this to work in VS 2010?


System.DirectoryServices.AccountManagement: FileNotFound exception while creating PrincipalContext o

  
Hi, I want to create a local group for my Netapp server. And also add a domain user under this group. Using .NET namepaces System.DirectoryServices.AccountManagement, I can achive this for Windows server. But if the same code is tried on NetApp, following exception is thrown: Unhandled Exception: System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)   at System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.GetInfo()   at System.DirectoryServices.DirectoryEntry.RefreshCache()   at System.DirectoryServices.AccountManagement.PrincipalContext.DoMachineInit()   at System.DirectoryServices.AccountManagement.PrincipalContext.Initialize()   at System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx()    at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate)   at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, String identityValue)   at System.DirectoryServices.AccountManagement.GroupPrincipal.FindByIdentity(PrincipalContext context, String identityValue)   at AddGroup.Program.Main(String[] args) Does S

Creating assembly throwing an error as system.directoryservices assembly is not in the SQL Server

  
Hi, I am trying to create an assembly (DLL file that created by C# ) which uses System.DirectoryServices assembly. When I try with following script Create ASSEMBLY Addresstype From 'C:\ActiDirectoryFunctions\ActiveDirectoryFunctions.dll' I am getting following Error Assembly 'ActiveDirectoryFunctions' references assembly 'system.directoryservices, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request. From above error message, I learnt that System.DirectoryServices assembly is not in the SQL Server. I am using SQL SERVER 2005 SP2 and .Net Framework 3 is there in the machine How to manually add this assembly into this SQL Server Machine? Please let me know if you know Thank you, Raj Dreaming a world without any war in anywhere

how to get system.directoryservices.dll to version no 2.0.50727.4927

  
Hi i have vista machine which has .net framework 2.0, 3.5, 3.5sp1, 4.0 installed and version no for system.directoryservices.dll is 2.0.50727.3053. i have another windows server r2 machine which has .net framework 2.0 and 3.5 installed on it and system.directoryservices.dll version is 2.0.50727.4927. could anyone tell me how to upgrade my vista dll to 2.0.50727.4927. i am surprised because i have all possible installation on vista but version is lower thn my r2 machine. i want this because we need to access addtional code defined in later version.

Performance Counters to monitor DirectoryServices.AccountManagement and Security.AccessControl activ

  

Hi Everyone,

I'm writing an application that takes in a file name as input, and then extracts its ACLs using FileSecurity.GetAccessRules().  Once I have these ACLs, I go through and identify each group member, obtain a group principal using Principal.FindByIdentity(), and traverse group principals using GroupPrincipal.GetMembers().  Undoubtedly the first call is going to hit the share where the file is located, and the next two calls are going to translate into LDAP queries against the AD server. 

I'm wondering, are there performance counters that I can attach to on the machine where the code runs so that I can monitor how hard I'm hitting each server?  The thing is that I'm not going to be able to attach a counter to the server iteself.  So Ideally, I would want to know how many bytes I'm sending out of this process per second.  I'm currently using category "Process", counter "IO Other Bytes/sec" to monitor activity.  However, this counter doesn't seem to map 1-to-1 from the data that it reports and the data that Perfmon reports on the network share / AD server.  The mapping seems to be more of a 1:5 relationship, so that when the local process reports that it's sending 10,000 bytes/sec, Perfmon reports that it's getting hit with 50,000 bytes/sec.  Is there a better counter to attach

inequality search with System.DirectoryServices.AccountManagement.PrincipalSearcher?

  

The System.DirectoryServices.AccountManagement are a great time-saver when working with Active Directory!  But now I'm stuck.

Is it possible to use inequality searches with PrincipalSearcher?  For instance, i have users with three types:

Glubflabs
Abadabs
Foos

and possibly more.  I want only non-Foo users.  With PrincipalSearcher's underlying DirectorySearcher, i could give it a string filter like this:

filter.Append("(&(objectCategory=Person)(objectClass=user)(sAMAccountName=*)(!description=Foo))");

With PrincipalSearcher, that inequality doesn't seem to be possible!  I've searched all through MSDN articles and haven't found anything that covers this.

Any help is appreciated!


Performance Counters to monitor DirectoryServices.AccountManagement and Security.AccessControl activ

  

Hi Everyone,

I'm writing an application that takes in a file name as input, and then extracts its ACLs using FileSecurity.GetAccessRules().  Once I have these ACLs, I go through and identify each group member, obtain a group principal using Principal.FindByIdentity(), and traverse group principals using GroupPrincipal.GetMembers().  Undoubtedly the first call is going to hit the share where the file is located, and the next two calls are going to translate into LDAP queries against the AD server. 

I'm wondering, are there performance counters that I can attach to on the machine where the code runs so that I can monitor how hard I'm hitting each server?  The thing is that I'm not going to be able to attach a counter to the server iteself.  So Ideally, I would want to know how many bytes I'm sending out of this process per second.  I'm currently using category "Process", counter "IO Other Bytes/sec" to monitor activity.  However, this counter doesn't seem to map 1-to-1 from the data that it reports and the data that Perfmon reports on the network share / AD server.  The mapping seems to be more of a 1:5 relationship, so that when the local process reports that it's sending 10,000 bytes/sec, Perfmon reports that it's getting hit with 50,000 byte

What is DirectoryServices Equivalent of ADSystemInfo

  

Hi All,

In jscript I can do something like below and get at the properties and their values associated with that user.

Set objSysInfo = CreateObject("ADSystemInfo")
strUserName = objSysInfor.UserName
Set objUser = Getobject ("LDAP://" & strUserName)
blah
blah

To do this in C#...what I've got working is fine...but I couldn't find something equivalent to the "CreateObject...." other than to reference the ActiveDs typlib to retrieve the AD username..which seems like a bit of hack...is there a way to do this without the ActiveDs typelib?

ActiveDs.

 

ADSystemInfoClass adObject =

iis 7 IP Security using System.DirectoryServices : Unable to update

  

I used the below code to Set  IP Security from my vb.net Application.  It is working in IIS 6 (windows xp, and server 2003).

facing error in IIS 7.5 (windows7).

' Get the IIS object that holds the info for the default site.

 

Dim SecObj As Object = GetObject("IIS://LocalHost/W3SVC/1/Root/WebServerSCM")

 

' Get the IIsIPSecurity object.

System.Directoryservices vs activeds

  

I have a dumb question - If I have a reference to System.Directoryservices in my .NET application, should the system have activeds.tlb imported into registry ? Is there a relation between using System.DirectoryServices and activeds ?

 

Thanks.


Active Directory bulk data update error System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIf

  

Hello, 

we are trying to update bulk data into Active Directory from some database table. If we run for say 40000 users, it fails in between While updating its failing with an exception that. The server is not operational.

at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
   at System.DirectoryServices.DirectoryEntry.Bind()
   at System.DirectoryServices.DirectoryEntry.get_AdsObject()
   at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
   at System.DirectoryServices.DirectorySearcher.FindOne()

Below is the piece of code updating the records ...

================================================================================

While drDataReader.Read()
                strMailID = drDataReader.Item(("EMAILID")).ToString()
                strAttributeName = drDataReader.Item("ATTRIBUTENAME").ToString().Trim()
                strAttributeValue = drDataReader.Item("ATTRIBUTEVALUE").ToString().Trim()
         &

Creating a ContactPrincipal (DirectoryServices.AccountManagement)

  

Greetings,

I am attempting (failing miserably, and hopefully it's all my fault and someone will have good news) to create a class that represents an Active Directory Contact object.  This is added to the Active Directory schema after you install Exchange.

I started by inheriting from System.DirectoryServices.AccountManagement.Principal, just like all the other Principals do (at least at their core, though User/Computer principals use an intermediary class called AuthenticablePrinciple).  But it seems like Microsoft does not want you actually making your own Principals for AD... This becomes obvious very quickly when you try to actually do anything with this inheritance... For instance, there is no way to store the PrincipalContext object inside the newly created ContactPrincipal since MyBase.Context is readonly, ContextRaw is a protected friend, and the actual storage value, ctx, is private...  So even when I use reflector to see how they store the context, in say GroupPrincipal, I find I can't duplicate this process as all the variables are inaccessible...

The next thing I tried was inheriting from UserPrincipal, even though in Active Directory the Contact object type is not a user, though it does share many other types with user.  I applied the DirectoryObjectClass attribute (with a value of "contact"),

System.DirectoryServices.DirectoryServicesCOMException: A referral was returned from the server.

  

I am trying to display all the properties for a user on a webpage.  This code works fine on the local workstation but when I try to run it on the iss server I get the following error:

Exception Details: System.DirectoryServices.DirectoryServicesCOMException: A referral was returned from the server.
If I comment out the Dim sr as searchresult... I do not get the error.  Here is the code:

Using
domain__1 As

System.DirectoryServices.Protocols problem after upgrading to Windows Server 2008 R2

  
Hopefully this is the correct forum...

I have a block of code (VB.NET) for creating connection object for an OpenLDAP directory that looks something like

_OL = New LdapDirectoryIdentifier(DirectoryServer, PortNumber, True, False)
_Conn = New LdapConnection(_OL)
_Conn.SessionOptions.SaslMethod = "GSSAPI"
_Conn.SessionOptions.ProtocolVersion = 3
_Conn.SessionOptions.Sealing = True
_Conn.SessionOptions.SspiFlag = _Conn.SessionOptions.SspiFlag Or &H10 'auth-conf
_Conn.Timeout = New TimeSpan(0, 20, 0) ' 20 minutes
_Conn.AuthType = AuthType.Negotiate

On a Windows Server 2008 computer, this block of code gives me an ldapconnection object
On a Windows Server 2008 R2 computer, this block of code throws an exception when attempting to set the SaslMethod property (Also tried setting to "SIMPLE", "GSS-SPNEGO" or "EXTERNAL")

Not very helpfully, the error message states simply "An unknown authentication error occurred" Error code = 86 in System.DirectoryServices.Protocols.LdapSessionOptions.SetStringValueHelper(LdapOption option, String value)

I have matched as much as possible except for OS version. Same .NET Framework version, same processor, same Windows edition

Any suggestions?
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend