Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
2.00/5 (3 votes)
See more:
I am trying to add local group to adam group and it throws an exception
"Only domain Principal objects can be inserted into groups in this store."


This is the code, groups are GroupPrincipal instances from System.DirectoryServices.AccountManagement

C#
adamGroup.Members.Add(machineGroup);
adamGroup.Save();


It works when trying to add domain group in adam group and adam group to adam group
Only local groups have this problem
Posted
Comments
Sandeep Mewara 27-Jun-12 8:05am    
adam group?
caknoris 27-Jun-12 8:15am    
Active Directory Application Mode, you can look at it as ContextType.ApplicationDirectory
lukeer 27-Jun-12 8:58am    
Don't post in the C# Forum[^] _and_ here. Pick one and stick to it.

1 solution

Why on earth would you try to add a local group to a domain group? It doesn't make any sense at all, for any situation I've ever seen.

Yes, it's never going to work. You cannot add a group or user from a local machine to a domain group. It can only hold domain users and groups.
 
Share this answer
 
Comments
caknoris 27-Jun-12 10:36am    
I am not adding Local group to Domain group. I am adding Local group to ADAM Group
Dave Kreskowiak 27-Jun-12 10:54am    
It doesn't matter. The group is still hosted by the domain. You cannot add local machine groups and users to Domain-based groups. The error message is telling you that very thing!

All ADAM is is Active Directory without servers as dedicated domain controllers. Your workstations become "domain controllers" in a sense. The concepts are still the same. You cannot add local groups to directory-based, or domain, groups.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900