Tuesday, 2 June 2020

NTFS Permissions Report using PowerShell

NTFS Permissions Report using PowerShell


$FolderPath = Get-ChildItem -Directory -Path "C:\Test" -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


No comments:

Post a Comment