title: "notlike" not working as expected in while loop using a file name
body: <p>Having the toughest time over something seemingly so small. I want to stay in the while loop while the file is not in the folder, when it is found and the file name is similar, then come out.</p>
  <pre><code>$path = &quot;\\xxx\yyy\&quot;
  
  function getFileName{
  $file = Get-ChildItem –Path $path | Where-object -property Name -like &quot;UserFile*&quot;
  $file = $file.Name
  }
  
  getFileName
  
  while($file -notlike 'UserFile*'){
  Write-Warning &quot;User file not found, ensure it is in the root folder of the LAN Share...&quot;
  Read-Host &quot;Press enter when the file is in the root folder to continue...&quot;
  
  getFileName
  }
  </code></pre>