check permission on folder network

Elazara Arbiv 161 Reputation points
2020-11-11T07:37:00.953+00:00

Hi,
I have network folders that I noticed the admin group does not have permissions on. I wanted to run the script to check which web folders are not allowed - but I could not:

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}
New-Object -TypeName PSObject -Property $Properties
}
}

I use it - but can only filter by group.
That is - hunt me for all the folders that the group of managers does not have permission for

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2020-11-17T08:50:15.8+00:00

    Hi,

    Please see if this works for you

    $group = "domain\helpdesk"  
    $folders = @()  
    ForEach ($Folder in $FolderPath) {  
        $NoPermission  = $true  
        $Acl = Get-Acl -Path $Folder.FullName  
        ForEach ($Access in $Acl.Access) {  
            if($Access.IdentityReference.Value -eq $group){  
                $NoPermission = $false  
            }   
        }  
        if($NoPermission){  
            $folders += $Folder  
        }  
    }  
    

    Best Regards,
    Ian

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2020-11-12T10:01:40.987+00:00

    Hi,

    What do you mean by the group of managers? The administrators group?

    Best Regards,
    Ian

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Elazara Arbiv 161 Reputation points
    2020-11-12T12:08:24.03+00:00

    Sample user group - a group that has members in the domain
    for example :
    domain\helpdesk

    0 comments No comments

  3. Elazara Arbiv 161 Reputation points
    2020-11-12T12:13:13.643+00:00

    I need to find all the network folders of the group: "domain\helpdesk" no permission on them

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.