Created
May 14, 2022 21:20
-
-
Save Trimad/9ca98d42ee39a28847f391d0b125a645 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Folder = "S:\path\to\folder" | |
$User = "Jane Doe" | |
$userPermissions = @() | |
$userPermissions += (Get-ADPrincipalGroupMembership $User).name | |
$folderPermissions = @() | |
$folderPermissions += (((Get-Acl $Folder).Access).IdentityReference).Value | |
$match = 0 | |
foreach($i in $folderPermissions){ | |
foreach($j in $userPermissions){ | |
if($i.contains($j)){ | |
$match = 1 | |
Write-Output "$User is a member of the security group $j which grants the user access to $Folder" | |
} | |
} | |
} | |
if($match -eq 0){ | |
Write-Output "$User does not have access to $Folder" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment