0

I have a text file with the exact paths of the folders that I want to get permission information from, and I am trying to use PowerShell to get the information from each folder. I want to add the information to a text file, with a delimiter value of ":"

Can someone please tell me what I am doing wrong...

$FullList = Get-Content "C:\Temp\ListofFoldersToCheck.txt"

$DataOutFile = "C:\Temp\PermissionInformation.txt"

Foreach ($Folder in $FullList)
{
    $ACLs = get-acl $Folder.Fullname | ForEach-Object { $_.Access }

    Foreach ($ACL in $ACLs)
    {
        $DataOutInfo = $Folder.FullName + ":" + $ACL.IdentityReference
        Add-Content -Value $DataOutInfo -Path $DataOutFile
    }
}

It is returning the error message: Get-Acl: Cannot validate argument on parameter 'Path'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

The $FullList data is separated by new lines, if that makes any difference.

Please help, this is driving me insane...

0

In your Foreach loop, the $Folder variable is a string. Strings do not have a Fullname property.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.