我编写了这个 shell 脚本来查询 Windows 搜索索引。
$sql = "SELECT System.ItemName, System.ItemPathDisplay, SYSTEM.FileOwner, System.ItemType
FROM SYSTEMINDEX
WHERE (SCOPE = 'C:\Users\Raghib\Desktop\1001') AND (CONTAINS(System.Search.Contents,'*Langevin*') OR CONTAINS(System.FileName,'*Langevin*')
OR CONTAINS(System.FILEOWNER,'*Langevin*'))"
$provider = "provider=search.collatordso;extended properties='application=windows';"
$connector = new-object system.data.oledb.oledbdataadapter -argument $sql, $provider
$dataset = new-object system.data.dataset
if ($connector.fill($dataset))
{
$dataset.tables[0] | select-object System.ItemName, System.ItemPathDisplay,
SYSTEM.FileOwner, System.ItemType | format-table -autosize *
}
它返回文件的所有元数据,但我也想获取文件的所有内容。有什么办法吗?
这是 SYSTEMINDEX 列属性的链接: https ://docs.microsoft.com/en-us/previous-versions//ff521735(v=vs.85)?redirectedfrom=MSDN