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\FindFolderO wner\Folde r.txt'
$Path = "\\nas01\personal$\" + $HomeFolders
Foreach ($homefolder in $Path)
{
Get-Item $Path | foreach-object {Get-Acl $_.Fullname}
if ($homefolder -ne 'BUILTIN\Administrators')
{
$df = $Path
}
}
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
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\FindFolderO
$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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER