Simple PowerShell snippet to search file or array for content

Since I play these days a lot with PowerShell I need from time to time some simple functionality. Sometimes dead simple. Like today , snippet to search file content or array of data if you will and return true/false if text is present in it.

function File-Contains-Row {
Param([array]$fileContent, [string]$searchedString)

Process {
#is there any string we search for in any of the rows?
[array]$resArray = $fileContent | where { $_ | Select-String –caseSensitive -Pattern $searchedString }

if ($resArray.Count -eq 0) {
return $false
} else {
return $true

As a project, you can find it here :

.ps1 file is here :



This site uses Akismet to reduce spam. Learn how your comment data is processed.