Script to remove NTFS permissions from shares

I have excel file to specify what permissions I want to remove on what folders.
I would like to have a script that would remove those specified permissions on those folders. The script should read the excel file with the permissions that I need to remove. Please help. Thank you so much.

Here is the columns in the excel file that script would read:

UNCPath      IdentityReference
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.

Lionel MMSmall Business IT ConsultantCommented:
I assume you mean which users to remove, if not, if you want to change a users permissions you would have to do it in multiple steps (as best as I know). Assuming you mean remove users and you file has 2 columns, one with unc path and one with user-names, run this
for /F "skip=1 tokens=1-2 delims=," %%i in (C:\Utils\Your-File.csv) do (
icacls %%i /remove:g your-domain\%%j /T
/remove:g removes all granted permissions for the user
creative555Author Commented:
Sorry for the delay. I am not very familiar with the powershell. If you could please post entire script that I can test out and remove users and groups from folders. I am not sure how to run it.

THank you so much!
Lionel MMSmall Business IT ConsultantCommented:
this is not a powershell scrip it is a regular batch script. Copy and paste the code into a file and save it with a name like RemovePermissions.bat then from a comamnd prompt type RemovePermissions and enter to run it.

However as mentioned in my earlier comment your excel file will need to have two sets of data for instance
\\server1\share1, bob
\\server1\share1, joan
\\server2\share3\, adam

then you will need a second file to add the permissions you want for instance
\\server1\share1, bob, F
\\server1\share1, joan, RX
\\server2\share3\, adam, R

so do you know which server and which shares you want to remove permissions from and then do you know what permissions you want to add and for which users?

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 very much!
Lionel MMSmall Business IT ConsultantCommented:
Did you get it to work?
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

From novice to tech pro — start learning today.