# PS1 script to check directories security permissions
cls

$drive = "S:"
$dirs = dir $drive | Where {$_.psIsContainer -eq $true} | ForEach-Object { $_.FullName }
foreach ($d in $dirs) {
   try 
   {
      (Get-Acl $d).Access | Select-Object @{Name="Folders"; Expression={$d}}, FileSystemRights, AccessControlType, IdentityReference, IsInherited 
   }
   catch 
   { 
      continue 
   }
}