Script to remove NTFS permissions from the shares

I need a script that would read excel file with columns Path, IdentityReference, etc and would remove the NTFS permissions for the user/groups accounts that i specify in the excel file including all its subfolders and files.

For example, I have a great script that gets all the permissions into the excel file. Now I want to modify excel file and use similar script to remove all the permissions I list in the excel file.

Please help. THank you very much.

# Include only folders from the root path
Get-ChildItem "C:\installs" -Recurse | ?{ $_.PsIsContainer } | %{
  $Path = $_.FullName

  (Get-Acl $Path).Access | Select-Object `
    @{n='Path';e={ $Path }}, IdentityReference, AccessControlType, `
    InheritanceFlags, PropagationFlags, FileSystemRights, IsInherited
} | Export-CSV "Permissions.csv"
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michael FowlerSolutions ConsultantCommented:
My not use VBA and do this directly from Excel. Here is an example of doing this which could be easily re-purposed for your needs
creative555Author Commented:
oh. I will have to try that. Thank you very much!

I did vlookups once again and see that I did have those groups listed in the input files that I used. So, I was wrong. I think some children got permission propagated from the top and that's why I saw the groups that I didn't expect to see on some subfolders. So, there is a slight issue with propagation of permissions. At least I need to understand how this script propagates the permissions if they are applied on top. Could you please explain what this script does and how the propagation of permissions get applied.

THank you very much
Michael FowlerSolutions ConsultantCommented:
I had a closer look at the script in the link I posted and it is changing share permissions rather than ntfs permissions.

This link has an entire application for changing ntfs permissions

and here is another ee answer for vba

As you can see this is not an easy programming task.

Note: By default child objects will inherit security permissions from the parent

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
creative555Author Commented:
THank you so much for the response. It would be a lot easier to use powershell script that would read the input csv file and remove NTFS permissions that I listed from the specified folders.

Could you please suggest the powershell script that would do that. Thank you so much.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.