Jump to content

Recommended Posts

Posted

Hi folks,

 

Can anyone recommend any apps that can make light work of file/folder permissions? e.g. take ownership, apply inherited permissions etc.

 

Looking for recommendations from people that have used them.

 

Thanks

Posted (edited)

I have used the following apps to change permissions...

 

As to which is best, that will depend on what you are trying to do. For example, are you looking for something to reset home folder permissions?

 

Here's a script that uses the NTFS Security PowerShell module to reset permissions on student user areas. You could adapt it to your needs. :)

 

#Requires -RunAsAdministrator
Import-Module NTFSSecurity

Get-ChildItem2 -Path "X:\Users\Students" -Directory | ForEach {

   Get-ChildItem2 -Path $_.FullName -Directory | ForEach {

       $UserName   = $_.Name
       $UserNameFQ = [io.path]::Combine($env:USERDOMAIN, $UserName)

       $_ | ForEach {

           try
           {
               Write-Output "$UserName - Setting permissions on $($_)"
               Add-NTFSAccess -Path $_.FullName -Account $UserNameFQ -AccessRights Modify -AccessType Allow -AppliesTo ThisFolderSubfoldersAndFiles -ErrorAction Stop
           }
           catch
           {
               Write-Warning "$($_.Exception.Message)`n"
           }

           try
           {
               Write-Output "$UserName - Setting owner`n"
               Get-ChildItem2 -Path $_.FullName -Recurse -Hidden -System -Force | Set-NTFSOwner -Account $UserNameFQ -ErrorAction Stop
           }
           catch
           {
               Write-Warning "$($_.Exception.Message)`n"
           }

       }
   }
}

 

^ The reason I am using Get-ChildItem2 instead of Get-ChildItem is because the former handles long file/folder names.

 

Run the following command to display the syntax of the various NTFS Security cmdlets.

 

Get-Command -Module NTFSSecurity -CommandType Cmdlet -Syntax | Out-GridView

Edited by Arthur
  • Thanks 2
Posted

Thanks! I have an issue where permissions on student folders keep resetting, so while I look deeper into the issue it will be useful to have something that just gives me the quickest way to take ownership of a folder and also switch it back to inheritable permissions. I doubt this can be done on mass because this of course a subfolder of the student's home folder.

 

I have a way to do it programatically as well, via TAKEOWN and ICACLS and a list of students. Next project will be to use PowerShell and read in the folders and do it, but need to find the underlying issue first ideally!

Posted
I doubt this can be done on mass because this of course a subfolder of the student's home folder.

Does the subfolder have the same folder name for each student?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...