Cmdlet
Search-OfficeDocument
Finds regular-expression or literal matches across supported files and folders.
Syntax
Search-OfficeDocument
[-CaseSensitive]
[-Extension <String[]>]
[-IncludePageLocations]
[-MaximumFiles <Int32>]
[-MaximumResults <Int32>]
[-MaximumStoreItems <Int32>]
[-Password <SecureString>]
[-Path] <String[]>
[-Pattern] <String[]>
[-Reader <OfficeDocumentReader>]
[-Recurse]
[-SimpleMatch]
[-ThrottleLimit <Int32>]
[-WholeWord]
[<CommonParameters>]#Parameter set:
PathSearch-OfficeDocument
[-CaseSensitive]
[-InputObject] <OfficeDocumentReadResult>
[-MaximumResults <Int32>]
[-Pattern] <String[]>
[-SimpleMatch]
[-WholeWord]
[<CommonParameters>]#Parameter set:
InputObjectSearch-OfficeDocument
[-CaseSensitive]
[-Extension <String[]>]
[-IncludePageLocations]
-LiteralPath <String[]>
[-MaximumFiles <Int32>]
[-MaximumResults <Int32>]
[-MaximumStoreItems <Int32>]
[-Password <SecureString>]
[-Pattern] <String[]>
[-Reader <OfficeDocumentReader>]
[-Recurse]
[-SimpleMatch]
[-ThrottleLimit <Int32>]
[-WholeWord]
[<CommonParameters>]#Parameter set:
LiteralPathExamples
Find invoice identifiers in a mixed folder.
Search-OfficeDocument ./Reports -Recurse -Pattern 'INV-\d+'Find literal text in an already read document.
Read-OfficeDocument ./Report.docx | Search-OfficeDocument -Pattern 'retention period' -SimpleMatchParameters
- -CaseSensitive SwitchParameter
- Use case-sensitive matching.
- -Extension String[]
- Selected source extensions, with or without leading dots.
- -IncludePageLocations SwitchParameter
- Compute Word and RTF page locations when supported.
- -MaximumFiles Int32
- Maximum selected files; zero means no limit.
- -MaximumResults Int32
- Maximum total matches per document across all patterns; zero means no limit.
- -MaximumStoreItems Int32
- Maximum items projected from each mail store; zero means all.
- -Password SecureString
- Open password for encrypted sources.
- -Path String[]
- Gets or sets input paths with provider wildcard expansion.
- -Pattern String[]
- One or more regular expressions, or literal strings with SimpleMatch.
- -Reader OfficeDocumentReader
- Use an immutable, caller-configured Reader.
- -Recurse SwitchParameter
- Include subfolders.
- -SimpleMatch SwitchParameter
- Treat patterns as literal text.
- -ThrottleLimit Int32
- Gets or sets the maximum number of concurrent background operations.
- -WholeWord SwitchParameter
- Accept matches only at word boundaries.
- -InputObject OfficeDocumentReadResult
- Normalized document to search without rereading a file.
- -LiteralPath String[]
- Gets or sets input paths without wildcard expansion, binding FileInfo.FullName and provider PSPath.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.
Outputs
PSWriteOffice.Models.Reader.OfficeDocumentSearchMatch: PowerShell-friendly occurrence returned by a path-based document search.