473,379 Members | 1,245 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

GetAccessControl for Active Directory Objects?

Hallo!
System.Security.AccessControl.FileSecurity (GetAccessControl) works fine.

Now I would like to use GetAccessControl for Active Directory Objects like
computers. I've searched a lot but I've found no solution.
Can anyone help me with an example or with a link to solve my problem?

Thanks a lot in advance!!!
Aug 19 '06 #1
10 5786
Try WMI

chanmm

"KarlM" <Ma******@newsgroup.nospamwrote in message
news:D9**********************************@microsof t.com...
Hallo!
System.Security.AccessControl.FileSecurity (GetAccessControl) works fine.

Now I would like to use GetAccessControl for Active Directory Objects like
computers. I've searched a lot but I've found no solution.
Can anyone help me with an example or with a link to solve my problem?

Thanks a lot in advance!!!

Aug 19 '06 #2
No, you shouldn't go that road, V2 of the FCL has all you need to get AD
object security programming correct.

Willy.

"chanmm" <ch*****@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
| Try WMI
|
| chanmm
|
| "KarlM" <Ma******@newsgroup.nospamwrote in message
| news:D9**********************************@microsof t.com...
| Hallo!
| System.Security.AccessControl.FileSecurity (GetAccessControl) works
fine.
| >
| Now I would like to use GetAccessControl for Active Directory Objects
like
| computers. I've searched a lot but I've found no solution.
| Can anyone help me with an example or with a link to solve my problem?
| >
| Thanks a lot in advance!!!
|
|
Aug 20 '06 #3

"KarlM" <Ma******@newsgroup.nospamwrote in message
news:D9**********************************@microsof t.com...
| Hallo!
| System.Security.AccessControl.FileSecurity (GetAccessControl) works fine.
|
| Now I would like to use GetAccessControl for Active Directory Objects like
| computers. I've searched a lot but I've found no solution.
| Can anyone help me with an example or with a link to solve my problem?
|
| Thanks a lot in advance!!!

Something like this will get you started.

using(DirectoryEntry computers = new
DirectoryEntry("LDAP://xxxxx/cn=computers,DC=...", ...))
{
foreach(DirectoryEntry computer in computers.Children)
{
Console.WriteLine(computer.Properties["cn"].Value);
ActiveDirectorySecurity compSecurity = comp.ObjectSecurity;
Console.WriteLine(compSecurity.GetSecurityDescript orSddlForm(AccessControlSections.Access));
}
}

Willy.
Aug 20 '06 #4
Thank you for your answer!

"chanmm" wrote:
Try WMI

chanmm

"KarlM" <Ma******@newsgroup.nospamwrote in message
news:D9**********************************@microsof t.com...
Hallo!
System.Security.AccessControl.FileSecurity (GetAccessControl) works fine.

Now I would like to use GetAccessControl for Active Directory Objects like
computers. I've searched a lot but I've found no solution.
Can anyone help me with an example or with a link to solve my problem?

Thanks a lot in advance!!!


Aug 21 '06 #5
Thank you for your answer! I'll try it and will tell you if it works.

"Willy Denoyette [MVP]" wrote:
>
"KarlM" <Ma******@newsgroup.nospamwrote in message
news:D9**********************************@microsof t.com...
| Hallo!
| System.Security.AccessControl.FileSecurity (GetAccessControl) works fine.
|
| Now I would like to use GetAccessControl for Active Directory Objects like
| computers. I've searched a lot but I've found no solution.
| Can anyone help me with an example or with a link to solve my problem?
|
| Thanks a lot in advance!!!

Something like this will get you started.

using(DirectoryEntry computers = new
DirectoryEntry("LDAP://xxxxx/cn=computers,DC=...", ...))
{
foreach(DirectoryEntry computer in computers.Children)
{
Console.WriteLine(computer.Properties["cn"].Value);
ActiveDirectorySecurity compSecurity = comp.ObjectSecurity;
Console.WriteLine(compSecurity.GetSecurityDescript orSddlForm(AccessControlSections.Access));
}
}

Willy.
Aug 21 '06 #6
Hi Martin,

Have you tried Willy's code? Does it work on your side? If you still need
any help or have any concern, please feel free to feedback, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 23 '06 #7
Hallo Jeffrey,

thanks for your answer. But I have just started to work at the project again
(another one became more urgent meanwhile). So I can't tell something about
the problem/solution at the moment.

""Jeffrey Tan[MSFT]"" wrote:
Hi Martin,

Have you tried Willy's code? Does it work on your side? If you still need
any help or have any concern, please feel free to feedback, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 29 '06 #8
Hi Martin,

Yes, I understand it. If you have to check it, please feel free to repost.
Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 30 '06 #9
Hallo!

I've found a solution like this:

string strMemberString = "LDAP://OU=Test,DC=Domain,DC=local";
DirectoryEntry computers = new DirectoryEntry();
computers.Path = strMemberString;
computers.Options.SecurityMasks = SecurityMasks.Owner | SecurityMasks.Group
| SecurityMasks.Dacl | SecurityMasks.Sacl;

foreach (DirectoryEntry computer in computers.Children)
{
if (computer.Name == "CN=TEst")
{
ActiveDirectorySecurity sdc = computer.ObjectSecurity;
NTAccount Account = new NTAccount("Domain\\XYZ");
SecurityIdentifier Sid =
(SecurityIdentifier)Account.Translate(typeof(Secur ityIdentifier));
ActiveDirectoryAccessRule rule = new ActiveDirectoryAccessRule(Sid,
ActiveDirectoryRights.ExtendedRight | ActiveDirectoryRights.GenericRead,
AccessControlType.Allow);
sdc.SetAccessRule(rule);
computer.CommitChanges();
}
}
""Jeffrey Tan[MSFT]"" wrote:
Hi Martin,

Yes, I understand it. If you have to check it, please feel free to repost.
Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 2 '06 #10
Cool, thank you for sharing with the community.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 4 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Toufani | last post by:
Hi everybody, I want to retrieve information about objects in active directory windows 2000 and their properties. I got some codes that don't work absolutely. for example I can't retrieve users...
0
by: Yaseen D M | last post by:
I am list groups of a user from active directory. I get the list but if i remove the user from one of the groups and again list the groups it still includes the groups from the the user was...
4
by: CodeRazor | last post by:
I need to retrieve a list of groups from Active Directory. Then i need to retrieve a list of users from a group. I'm unfamiliar with Active Directory objects. Can i connect to Active Directory...
1
by: tangus via DotNetMonster.com | last post by:
Hello all, I'm really struggling with getting some Active Directory code to work in ASP.NET. Can you please provide assistance? I am executing the following code: Dim enTry As DirectoryEntry =...
3
by: Jan Wrage | last post by:
Hi! I would like to implement a treeview in my existing application. It should show my entire Active-Directory structure, i.e. all Groups, Containers and OUs. Could somebody help me with...
4
by: IainM | last post by:
How can I enumerate AD objects (only in a given OU, not sub OUs) using the DirectoryEntry object? Let me know of this is the wrong forum for this question. Thanks, Iain
0
by: SAMEEP | last post by:
Hi, I am creating a project based on Active Directory in WIndows server 2003 How can I get the Objects of the Active Directory such as Computers,Contacts,Users,Groups,etc Using the VB.NET ...
0
by: bcanter | last post by:
I found a file on the web that will allow you to enumerate groups but it was an .hta and the top level admins won't allow this. I need to give managers access to the groups so that when a new user is...
3
by: Dirk Hagemann | last post by:
Hi! Does anyone has experience with manipulating MS Active Directory objects? I'd like to delete some users from a group, but so far I couldn't find anything about this. There is some good...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.