It's not pretty, but try this PS script. (I hacked this together years ago. Don't remember where I got the initial code.)
# use this query to see all items.
#$query = "SELECT System.ItemName, system.ItemPathDisplay, System.ItemTypeText, System.Size FROM SystemIndex"
# use this query to search on a word
#$query = "SELECT System.ItemName, system.ItemPathDisplay, System.ItemTypeText, System.Size FROM SystemIndex where contains('kawasaki')"
# https://learn.microsoft.com/en-us/windows/win32/search/-search-sql-folderdepth
# SCOPE='file:C:/users/'
# use this query to search on a directory
$query = "SELECT System.ItemName, system.ItemPathDisplay, System.ItemTypeText, System.Size FROM SystemIndex where SCOPE='file:G:/'"
$objConnection = New-Object -ComObject adodb.connection
$objrecordset = New-Object -ComObject adodb.recordset
$objConnection.commandtimeout = 30000
$objconnection.open( "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';")
$objrecordset.open($query, $objConnection)
$i = 0
Try { $objrecordset.MoveFirst() }
Catch [system.exception] { "no records returned";return }
do
{
$i = $i + 1
$typ = ($objrecordset.Fields.Item("System.ITemTypeText")).value
$fn = ($objrecordset.Fields.Item("System.ItemPathDisplay")).value
#"$i - $typ - $fn"
$fn # just display file name
$size = ($objrecordset.Fields.Item("System.Size")).value
$in = ($objrecordset.Fields.Item("System.ItemName")).value
#" $size - $in" # additional fields
if(-not($objrecordset.EOF))
{
$objrecordset.MoveNext()
}
} Until ($objrecordset.EOF)
"Record count $i"
$objrecordset.Close()
$objConnection.Close()
$objrecordset = $null
$objConnection = $null