Finding Files Owned by a User

by Jun 26, 2012

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*

Twitter This Tip! ReTweet this Tip!