Powershell: Get File Details and Owner Information in a GUI

Filter option example for out-gridview
Fil­ter option exam­ple for out-grid­view

A quick and dirty script to grab file details recur­sive­ly includ­ing the own­er info. A col­league was scour­ing the web look­ing for an app to do this. He also want­ed to abil­i­ty to quick­ly fil­ter the results based on the last write time. This is a per­fect use case for Out-Grid­View.

$path = "C:\Chocolatey"
$allfiles = @()

foreach ($item in (Get-ChildItem -Recurse -Path $path)) {
    $acl = Get-Acl -Path $item.FullName
    $allfiles += New-Object PSobject -Property @{
        LastWrite = $item.LastWriteTime
        Path = $item.FullName
        FileName = $item.Name
        Folder = $item.Directory
        Owner = $acl.Owner
    }
}

$allfiles | Out-GridView