You are here

PowerShell - List All Directories With Users Who Can Access

Maybe this is a one-off type of thing, but if you need to see every folder within a directory and get the list of who can access that folder, it can be done using PowerShell. The output is tab-separated and can easily paste into an Excel sheet.


$items = get-childitem -R | Where-Object {$_.PSIsContainer -eq $true}

foreach($item in $items)
    $access_list = $item|get-acl; # gets access list
    foreach($user in $access_list)
        $user_names = $user.Access
        foreach($user_name in $user_names)
            Write-Host $item.Fullname "`t" $user_name.IdentityReference
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
12 + 4 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer