Filter objects by name with logical operators (AND/OR/NOT) for powerful object filtering in PowerShell.
- Logical Filtering: Use AND, OR, and NOT operators to filter objects by name
- Flexible Syntax: Multiple ways to express filter conditions
- Pipeline Support: Works seamlessly with PowerShell pipeline
- Alias Support: Use
fobas a shorthand forFind-ObjectByName
# Install from PowerShell Gallery
Install-Module -Name FindObject -Scope CurrentUser
# Import the module
Import-Module FindObject# Find objects containing "test"
Get-ChildItem | Find-ObjectByName "test"
# Using the alias
Get-ChildItem | fob "test"# AND operator - name must contain both terms
Get-ChildItem | fob "test", "file"
Get-ChildItem | fob "test AND file"
# OR operator - name must contain at least one term
Get-ChildItem | fob "test OR file"
# NOT operator - exclude items containing term
Get-ChildItem | fob "test NOT backup"# Find all PowerShell scripts except backup files
Get-ChildItem -Recurse | fob ".ps1 NOT backup"
# Find files with either "log" or "txt" in the name
Get-ChildItem | fob "log OR txt"
# Find files containing both "report" and "2024"
Get-ChildItem | fob "report", "2024"
# Complex filtering with multiple operators
Get-Process | fob "chrome OR firefox NOT helper"# Find all JavaScript or TypeScript files
Get-ChildItem -Recurse | fob ".js OR .ts"
# Find markdown files that aren't README files
Get-ChildItem | fob ".md NOT readme"
# Find all test files
Get-ChildItem -Recurse | fob "test", ".spec"# Find Chrome processes but not helper processes
Get-Process | fob "chrome NOT helper"
# Find either Firefox or Edge processes
Get-Process | fob "firefox OR msedge"# Find Windows Update services
Get-Service | fob "windows", "update"
# Find SQL or MySQL services
Get-Service | fob "sql OR mysql"fob "term1", "term2" # Array syntax
fob "term1 AND term2" # Explicit AND
fob "term1", "term2", "term3" # Multiple termsfob "term1 OR term2"
fob "term1 OR term2 OR term3"fob "term1 NOT term2"
fob "include OR this NOT exclude"- FilterString: The filter expression (supports arrays for AND logic)
- InputObject: Objects to filter (accepts pipeline input)
- PowerShell 5.1 or later
- Works on Windows, macOS, and Linux
MIT License - See LICENSE file for details
Matthew Bubb