How to list all files with no Owner set

list all files with no Owner set

Goal

When performing file migrations it can be difficult to set perms on files with long paths so being able to list all files with no Owner set can be really helpful.

Solution

$Path = "c:\Test"
$LogPath = "c:\test"
Get-ChildItem $Path -force -Recurse | Select Name,Directory,@{Name="Owner";Expression={(Get-ACL $_.Fullname).Owner}},CreationTime,LastAccessTime | Export-Csv $LogPath\FileFolderOwner.csv -NoTypeInformation

If you found this article helpful, would you consider buying me a Coffee?

Leave a Reply

Your email address will not be published. Required fields are marked *