Link to home
Start Free TrialLog in
Avatar of CaussyR
CaussyR

asked on

List Folder Owners

Hi everyone,

I am reading in a text file, folder.txt, which has 2 folder names entered.  This is then read into a variable called $Homefolders.

I have tried the below, but for some reason it reads the second folder in and I get something like :

Get-Item : Cannot find path '\\nas01\personal$\folder1 folder2' because it does not exist.


All I need to do is list the folder owners and find out which folders have an owner of 'BUILTIN\Administrators. Below is the script I am trying to work on...

$HomeFolders = get-content 'C:\_PSScripts\FindFolderOwner\Folder.txt'

$Path =  "\\nas01\personal$\" + $HomeFolders

Foreach ($homefolder in $Path)
{

    Get-Item $Path | foreach-object {Get-Acl $_.Fullname}

    if ($homefolder -ne 'BUILTIN\Administrators')
    {
        $df = $Path

    }

}
ASKER CERTIFIED SOLUTION
Avatar of Recept
Recept

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CaussyR
CaussyR

ASKER

Thanks PeterRecz, that's exactly what I wanted....