Question Locked

need script to list folder permissions in folder tree

0 helpful
11 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

There is a folder that contains subfolders that each contain time-clock data.
The auditors want a spreadsheet detailing who has access to the folders.
I created(altered) a script that listed all the users in the groups that had access to the folders, but I discovered that a previous administrator had granted access to individuals as well as groups (!).
With over a hundred sub-folders, I don't relish checking the permissions of each folder individually.
Any help, suggestions, ideas would be appreciated.

11 replies

by sivaps

Can some help me to have script to list folder permissions in folder tree

by owellwhatever

Sorry to dig up an old thread, but I spent many many hours searching for a way to do this myself. Found out it's not too hard with Powershell 2.0!

get-childitem c:\data -recurse | where{$_.psiscontainer} | get-acl | Out-Gridview

You can then copy and paste the data to a doc or whatever. I found it much harder to try to get the formatting correct using outher out- options. Found this info here:

http://blogs.msdn.com/b/powershell/archive/2009/03/12/out-gridview-revisited.aspx

Cheers

by eprovazek

Take the following and save it as a .ps1 file. Obvisously change the F:\ to the root directory of where you want to map out permissions, and change the location and name of the output file. This script only maps out where permissions are not inherited, so start with the root of where inheritable permissions are granted.
Once saved, run this in a command window:
powershell \.ps1

Get-childitem F:\ -recurse | where{$_.psiscontainer} |
Get-Acl | % {
$path = $_.Path
$_.Access | % {
New-Object PSObject -Property @{
Folder = $path.Replace("Microsoft.PowerShell.Core\FileSystem::","")
Access = $_.FileSystemRights
Control = $_.AccessControlType
User = $_.IdentityReference
Inheritance = $_.IsInherited
}
}
} | ? {-not $_.Inheritance} | export-csv C:\test_dump.csv -force

by croberts

Cannot get this to work, perhaps the formatting in this posting messed it up. I have Powershell 2.x installed, but it says:

"The term '\.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

by croberts

Nevermind - I just opened Powershell directly, and copied everything but the first line and it worked. Thanks!!

by croberts

FYI - Got this to work on Windows 7 / 2008R2, but cannot get it to work on XP / 2003 even though all Powershell 2.x updates are all installed.

by damack13

Thanks! This works great. How do I get this to go through all of the sub folders inside of subfolders from the root path I specify?

This discussion is closed to new replies.