Beta 42

Research and Development

Menu

PowerShell - Finding Files Owned by a User

Here's a simple filter that will show only those files and folders that a specific user is owner of.

filter Get-Owner ($Account="$env:UserDomain\$env:USerName") {
    if ((Get-ACL $_.Fullname).Owner -like $Account) {
        $_
    }
}

It is very easy to use. By default, it checks for files and folders owned by you:

PS> Dir $home | Get-Owner

You can specify a specific user name (including domain part) or use wildcards as well:

PS> Dir $home | Get-Owner *system*