Tag: gridview

Powershell: Get File Details and Owner Information in a GUI

Filter option example for out-gridview
Filter option example for out-gridview

A quick and dirty script to grab file details recursively including the owner info. A colleague was scouring the web looking for an app to do this. He also wanted to ability to quickly filter the results based on the last write time. This is a perfect use case for Out-GridView.

$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