I have an application that runs against AD using System.DirectoryServices.AccountManagement. It is working but as there is a delay due to replication at remote sites I was asked to update it to make the changes on the remote DCs. This is working but the
query .GetGroups against the same PrincipalContext object is returning data from the Central DCs not the specified DC. Code follows for the context but to summarize, I specified the server and the changes are occuring on the specified server but when I specify
the server and query the results are not coming from the specified server.
We are running Server 2008. I have included and not included domain credentials. I tried specifying ContextOptions.ServerBind but it errors telling me that I must specify negotiate or simplebind and that the two cannot be combined.
myrth
Member
12 Points
2 Posts
incorrect response using AccountManagement
Nov 10, 2010 08:20 PM|LINK
I have an application that runs against AD using System.DirectoryServices.AccountManagement. It is working but as there is a delay due to replication at remote sites I was asked to update it to make the changes on the remote DCs. This is working but the query .GetGroups against the same PrincipalContext object is returning data from the Central DCs not the specified DC. Code follows for the context but to summarize, I specified the server and the changes are occuring on the specified server but when I specify the server and query the results are not coming from the specified server.
We are running Server 2008. I have included and not included domain credentials. I tried specifying ContextOptions.ServerBind but it errors telling me that I must specify negotiate or simplebind and that the two cannot be combined.
I am confused despite teh helpful articles at http://www.codeproject.com/KB/system/usingAccountManagement.aspx and http://msdn.microsoft.com/en-us/library/bb384384(v=VS.90).aspx and a number of other sites.
PrincipalContext insPrincipalContext = new PrincipalContext(ContextType.Domain, serverName,
"DC=my,DC=site,DC=ca", ContextOptions.Negotiate);