title: Get-Content: Cannot find path because it does not exist
body: <p>I wrote the following script in which <code>Servers.txt</code> file contains a list of servers:</p>
  <pre><code>$Result = @()
      
  foreach ($server in (gc .\Servers.txt)) {
  
      $computer = [ADSI](”WinNT://” + $server + “,computer”)
      $Group = $computer.psbase.children.find(”Administrators”)
  
      function getAdmins {
          $members = ($Group.psbase.invoke(”Members”) | % { $_.GetType().InvokeMember(”Adspath”, ‘GetProperty’, $null, $_, $null) }) -replace ('WinNT://DOMAIN/' + $server + '/'), '' -replace ('WinNT://DOMAIN/', 'DOMAIN\') -replace ('WinNT://', '')
          $members
      }
  
      $Result += Write-Output &quot;SERVER: $server&quot;
      $Result += Write-Output ' '
      $Result += ( getAdmins )
      $Result += Write-Output '____________________________'
      $Result += Write-Output ' '
  }
  
  $Result &gt; c:\results.txt
      
  Invoke-Item c:\results.txt
  </code></pre>
  <p>If I run this script, I get the error:</p>
  <blockquote>
  <p>PS C:&gt; C:\LocalUsers.ps1 Get-Content : Cannot find path
  'C:\Servers.txt' because it does not exist. At C:\LocalUsers.ps1:3
  char:23</p>
  <ul>
  <li>foreach($server in (gc &lt;&lt;&lt;&lt;  .\Servers.txt)){
  <ul>
  <li>CategoryInfo          : ObjectNotFound: (C:\Servers.txt:String) [Get-Content], ItemNotFoundException</li>
  <li>FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand</li>
  </ul>
  </li>
  </ul>
  </blockquote>
  <p>Why do I keep getting this error? How do I solve this?</p>