/searchutils

Set of scripts and techniques to search for through office documents, or leverage the Windows indexing service

Primary LanguagePowerShellMIT LicenseMIT

searchutils

Scripts and techniques to search for keywordss in Office documents, and leverage the Windows Indexing Service for quick file content searches.

Usage

Search-OfficeDocuments

Using the Office COM Objects this script will open Word and Excel files to search for the provided keyword. It will also look if the filename itself matches the keyword.

gci -r * | Search-OfficeDocuments | ft

Invoke-WindowsSearch

This script directly connects to the Windows Search database and queries for the provided keyword.

Invoke-WindowsSearch password

Long Path Names

Paths over 256 chars will produce errors, to enable long path names see the following Microsoft article and/or follow these steps:

  1. Start the registry editor (regedit.exe)
  2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
  3. Double-click LongPathsEnabled
  4. Set to 1 and click OK
  5. Reboot

Learn more

Some more useful information can be found below: