This project is read-only.

Powershell Need Help using AlphaFS to recurse folders

Jan 22, 2015 at 4:56 PM
Hello,

I am using PowerShell 2.0 on my server and I wrote the script below to recurse all subfolders and find every folder that a particular user has permissions to access. The script works great untill it encounter the long paths. Can someone please help me to do the same thing using AlphaFS so that I can actually locate the complete list and add another user to those exact folders with the same ACLs.
#Set variables
$Path = “d:\"
$UserName = "ABC\Username"
$filename = "c:\Temp\ACLResult.csv"

#LOGIC
$folders = Get-ChildItem -path $Path -force -recurse | Where {$_.PSIsContainer}
ForEach ($folder in $folders)
{ 
  $PSPath = (Convert-Path $folder.pspath)
  if (Get-Acl -path $PSPath |Select -ExpandProperty Access| Where {$_.IdentityReference -like  $UserName})
    {
     $ACLInherited = Get-Acl -path $PSPath |Select -ExpandProperty Access| Where {$_.IdentityReference -like $UserName} 
     $list = ("$PSPath")
     $list, $ACLInherited.IsInherited | format-table |Out-File -append $filename
    } #end-if
}#end-For
Thank you for your help!
Jan 26, 2015 at 6:52 AM
Edited Jan 26, 2015 at 6:52 AM
I have a similar interest for recursing folders and finding older (7 days) folders/files for deleting - so we are two with a similar problem ... it would be worth to help us twice ;) ... please help us!
Peter
Jan 26, 2015 at 2:54 PM
Edited Jan 26, 2015 at 2:55 PM
So far I got this far in my Powershell code, as long as I have permissions to access the folder. Otherwise it just stops with an error message instead of moving to the next folder in the tree

CODE
#Load Assembly DLL
[Reflection.Assembly]::LoadFile("C:\AlphaFS.dll")

#Initialise Variables
$Path = "D:\"

#Read all folders into $Folders Array Variable
$Folders= [Alphaleonis.Win32.Filesystem.Directory]::GetDirectories($Path,"*","AllDirectories") 

#Display each Folder
Foreach ($Folder in $Folders) 
{
get-acl $Folder
}
ERROR
Exception calling "GetDirectories" with "3" argument(s): "(5) Access is denied: [\\?\d:\FolderName"
At C:\Get-AllFolders.ps1:8 char:67
+ $Folders= [Alphaleonis.Win32.Filesystem.Directory]::GetDirectories <<<< ($Path,"*","AllDirectories")
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException
Developer
Jan 26, 2015 at 9:49 PM
We are not on CodePlex anymore.

Please check: https://github.com/alphaleonis/AlphaFS/wiki
Developer
Jan 29, 2015 at 8:40 AM
AlphaFS Issues can be reported here: https://github.com/alphaleonis/AlphaFS/issues