title: Search For String In File Using Variables
body: <p>Having some trouble searching a log file. I have a basic script that searches for specific text in a log file. The problem is, I am trying to use variables that can be adjusted by the user at the command line but I cannot get them to be recognized. The script should output the results back to the screen.</p>
  
  <pre><code>param (
  [string]$file ,
  [string]$Ip ,
  [string]$port
  )
  Get-Content -Path C:\$file | Where-Object {$_ -like $Ip -and $_ -like $port}
  </code></pre>
  
  <p>Example of command line to execute script:</p>
  
  <p><code>PS C:\&gt; .\LogSearch.ps1 logfile04.txt 192.168.1.7 21</code></p>
  
  <p>In this case, <code>logfile04.txt</code> is the file, the port is <code>21</code> and the IP address is <code>192.168.1.7</code></p>
  
  <p>At this point of running the script, I am returned with nothing, but there is that line within the file.</p>
  
  <p><code>4|Oct 19 2015|18:28:39|106023|75.76.77.80|50077|192.168.1.7|21|Deny tcp src</code></p>