• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 41
  • Last Modified:

How do I change file permission to a certain file pattern to sub folders of my current directory?

We have a Windows 2012 R2 server into which people can log in with their ID using Remote Desktop.
Is it possible to make certain files eg .bat files read only whilst keeping csv files read write on a given drive or directory?
If it can't be done directly through windows settings, what about a batch file or .NET program to go through each bat file on the drive or directory.
0
AlHal2
Asked:
AlHal2
  • 2
2 Solutions
 
Alex Green3rd Line Server SupportCommented:
Get-Childitem "Location" -recurse| Get-acl | Export-csv C:\temp\ACL.csv

Open in new window


The below is what I used to test

Get-Childitem "c:\temp" -Recurse | Get-acl | Export-csv c:\fileperm.csv

Open in new window


Or something along those sorts of lines, you can pull everything into a CSV file. You should be able to sort that and deal with the permissions via the CSV and then pipe that back into a set-ACL and then set the security permissions that way
0
 
ThierrySysAdminCommented:
How about some old-school dos command:
ATTRIB +R *.BAT /S

Open in new window

0
 
Alex Green3rd Line Server SupportCommented:
Well I kinda figured he wanted a more secure way but that would work I guess.
0
 
AlHal2Author Commented:
Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now