Solved

How do I change folder permission programatically which are grayed out

Posted on 2008-10-10
2
686 Views
Last Modified: 2012-05-05
I need to programatically remove permissions from the a user's Desktop folder on Windows Server 2003.  My problem is that when the user's profile is created, the desktop folder permissions are grayed out because they are inherited and therefore ignore any attempt of my code to edit them.  IF I manually uncheck the "Inherit from parent..." box, then the code works fine.  How can I overcome this, and if necessary, uncheck the inheritance box by code?   My VB.Net code is attached:


Dim dInfo As New DirectoryInfo(DirectoryName)
 
Dim dSecurity As DirectorySecurity = dInfo.GetAccessControl()
     
dSecurity.RemoveAccessRule(New FileSystemAccessRule(Account, Rights, ControlType))
 
dInfo.SetAccessControl(dSecurity)

Open in new window

0
Comment
Question by:itsupportgoodwill
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 31

Accepted Solution

by:
Henrik Johansson earned 500 total points
ID: 22692291
You can't remove inherited permissions without breaking/unticking the inheritance option.

See if JSI Tip 8225 helps
http://windowsitpro.com/article/articleid/81268/jsi-tip-8225-the-extended-change-access-control-list-tool-xcaclsvbs-has-been-enhanced-and-replaces-xcaclsexe.html
0
 
LVL 1

Author Closing Comment

by:itsupportgoodwill
ID: 31505233
That's just what I needed.  Thank you
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ASP.NET MVC -Update model when click on <li> element 29 70
NTP time source for DC 3 54
SSIS Paramater on start 2 28
Time server on domain 3 25
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question