Skip to content

Instantly share code, notes, and snippets.

@kevincdurand1
Created December 8, 2020 21:40
Show Gist options
  • Select an option

  • Save kevincdurand1/446aae404435fd248b1973bdcdecebcd to your computer and use it in GitHub Desktop.

Select an option

Save kevincdurand1/446aae404435fd248b1973bdcdecebcd to your computer and use it in GitHub Desktop.
Get NTFS File Permissions Using PowerShell
$FolderPath = Get-ChildItem -Directory -Path "C:\temp\" -Recurse -Force
$Output = @()
ForEach ($Folder in $FolderPath) {
$Acl = Get-Acl -Path $Folder.FullName
ForEach ($Access in $Acl.Access) {
$Properties = [ordered]@{'Folder Name'=$Folder.FullName;'Group/User'=$Access.IdentityReference;'Permissions'=$Access.FileSystemRights;'Inherited'=$Access.IsInherited}
$Output += New-Object -TypeName PSObject -Property $Properties
}
}
$Output | Out-GridView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment