Skip to content

Instantly share code, notes, and snippets.

@xoner
Last active August 29, 2015 14:13
Show Gist options
  • Save xoner/7e6d6311a779a919e9e4 to your computer and use it in GitHub Desktop.
Save xoner/7e6d6311a779a919e9e4 to your computer and use it in GitHub Desktop.
Recursively looks for files owned by a specified user in a folder and exports them to a csv (excel) spreadsheet.
Get-ChildItem -Force -Recurse -File |
Select *,@{n='Owner';e={(Get-Acl -LiteralPath $_.FullName).Owner}} |
Where {$_.Owner -eq 'DOMAINNAME\username'} | Select FullName, Owner, Length |
Export-Csv Files-User.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment