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*
No comments yet.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

revia in alcoholism