title: Powershell export output variable to file not found
body: <p>I have the following script and as much as I try to send the output result, it does not go to the file and therefore the txt file is empty, if you can tell me where I am failing I would appreciate it.</p>
  <pre><code>Clear-Content .\telnet.txt
  
  Write-host &quot;Prueba de conexión de puertos&quot;
  '-'*30
  ' '*25 
  $test = @('WEB:google.com:443','WEBSERVER_HTTP:www.noticias3d.com:80') 
  Foreach ($t in $test)
  {
    $description = $t.Split(':')[0]
    $source = $t.Split(':')[1]
    $port = $t.Split(':')[2]
    
    Write-Host &quot;Conectando a $description host $source puerto $port&quot;
    try
    {
      $socket = New-Object System.Net.Sockets.TcpClient($source, $port)
      $_.Message
    }
    catch [Exception]
    {
      Write-Host $_.Exception.GetType().FullName
      Write-Host $_.Exception.Message
    }
  
  
  Out-File -FilePath telnet.txt
  
   Write-Host &quot;Revisado`n&quot;
  }
  
  
  #$wsh = New-Object -ComObject Wscript.Shell
  
  #$wsh.Popup(&quot;Finalizado checklist de Plataforma&quot;)
  </code></pre>