Check a file location for acl's containing a group name.
Just log if an acl is present for the group I'm searching for. You could easily add code to the ACL not found section but I wanted to keep it basic to help others follow.
Just update $DirectoryList for the location and $GroupID for the ad group. It should then genereate a file with the ouput for if it did or didn't find the acl.
 
PowerShell
Edit|Remove
#Windows PowerShell Code########################################################################### 
# 
# AUTHOR: John Grenfell 
# 
########################################################################### 
 
<# 
.SYNOPSIS 
    Check a file location for acl's containing a group name 
.DESCRIPTION 
    Just log if an acl is present for the group I'm searching for 
.EXAMPLE 
    .\Check-ACL.ps1 
.NOTES 
    You could add code to the ACL not found section but I wanted to keep it basic to help others follow. 
 
#> 
 
Import-Module ActiveDirectory 
 
 
# $DirectoryList to your netowrk location ie  $DirectoryList = "\\BigServer1\GroupDrives" 
$DirectoryList = "\\server1\groups" # Build the list 
Set-Location $DirectoryList 
 
# Change $GroupID to your add group ie  $GroupID = "ADHelpDesk" 
$GroupID = "CHANGEME" 
 
# Change you log location if you don't want to fill up the root of oyur drive ;o) 
$Path = "c:\" 
$ProgessLog = "Check-ACL.txt" 
$ErrorLog = "Check-ACLError.txt" 
 
#Logging function 
Function Log-Message(){ 
    Param($Message = ".") 
    Write-Verbose $Message 
    Write-Output $Message | Out-File "$Path$ProgessLog" -Append -Force 
} 
 
 
#Error trap 
trap [Exception] { 
    $MyInvocation.InvocationName 
    Log-Message $($MyInvocation.InvocationName + " Error: " + $_.Exception.GetType().FullName); 
    Log-Message $($MyInvocation.InvocationName + " Error: " + $_.Exception.Message);  
    continue; 
} 
 
$Folders = Get-ChildItem $DirectoryList 
 
ForEach ($Folder in $Folders) { 
 
      If (((Get-Acl $Folder).access | ForEach {$_.IdentityReference}) -match $GroupID){ 
            Log-Message "$($Folder.FullName) - ACL found for $($GroupID)" 
 
        } 
        Else{ 
            Log-Message "$($Folder.FullName) - ACL not found for $($GroupID)" 
 
        } 
 
}