Permissions
Get-ChildItem -Path <path> -Recurse -File | Where-Object { $_.GetAccessControl().Access.IdentityReference -like "<username>*" } | Select-Object FullNameGet-ChildItem -Path <path> -Recurse -File | Where-Object { $_.GetAccessControl().Access | Where-Object { $_.FileSystemRights -eq "FullControl" -and $_.IdentityReference -like "<username>*" } } | Select-Object FullNameGet-ChildItem -Path <path> -Recurse -File | Where-Object { $_.GetAccessControl().Access | Where-Object { $_.FileSystemRights -eq "Modify" -and $_.IdentityReference -like "<username>*" } } | Select-Object FullNameGet-ChildItem -Path <path> -Recurse -File | Where-Object { $_.GetAccessControl().Access | Where-Object { $_.FileSystemRights -eq "Read" -and $_.IdentityReference -like "<username>*" } } | Select-Object FullNameGet-ChildItem -Path "C:\Folder" -Recurse -File | Where-Object {
$_.GetAccessControl().Access | Where-Object {
$_.FileSystemRights -eq "FullControl" -and $_.IdentityReference -like "BUILTIN\Administrators"
}
} | Select-Object FullName$acl = Get-Acl -Path "C:\TestFolder"
$hasWriteAccess = $acl.Access | Where-Object {
$_.IdentityReference -like "DOMAIN\MyGroup*" -and $_.FileSystemRights -band [System.Security.AccessControl.FileSystemRights]::Write
}
if ($hasWriteAccess) {
Write-Host "The group has Write access."
} else {
Write-Host "The group does not have Write access."
}Last updated