Verify blocks of text in a file with powershell
<p>I have a folder full of Cisco configurations. I am having a difficult time trying to find a way to verify strings of commands that are in the configuration. </p>

<p>I have no problem with single line commands and am currently using the following for that with 100% success:</p>

<pre><code>Get-childitem -path $Path -recurse |foreach-object{if (-not (select-string -inputobject $_ -Pattern "banner login")){$_}} | select name | Out-file $OutPath\OutputName.txt
</code></pre>

<p>I would like to verify commands such as this:</p>

<pre><code>    access-list 69 remark Name
    access-list 69 permit x.x.x.x
    access-list 69 permit x.x.x.x
    access-list 69 permit x.x.x.x
</code></pre>

<p>The 4 lines will be the same through out all configurations. I have tried..</p>

<pre><code>    Get-childitem -path $Path -recurse |foreach-object{if (-not (select-string -inputobject $_ -Pattern "access-list 69 remark Name", "access-class xx in", "access-list 69 permit x.x.x.x", "access-list 69 permit x.x.x.x", "access-list 69 permit x.x.x.x")){$_}} | select name | Out-file $OutPath\OutputText.txt
</code></pre>

<p>...but that only checks for each of those commands separately and reports all configuration files as compliant. I am trying to verify that specific block in that exact order. Thank you for your time.</p>