Kruthika Reddy Kruthika Reddy - 4 months ago 24
PowerShell Question

" list of files and subfoldes owner information" with powershelll script

I can see some in this link"https://community.spiceworks.com/scripts/show/1722-get-fileowner"

I tried but the examples but neither of them was working for me.Thanku!!!

Answer

This will do it

get-childitem c:\users\usera\documents -Recurse | foreach{
    $f = $_.FullName
    $o = Get-Acl $f | Select Owner -ExpandProperty Owner
    Write-Output "$f is owned by $o"
}