title: writing output file as .txt or .csv to script containing multiple conditions
body: <p>I have written a script which checks a service status, tests two paths and also tests a registry value.  Currently I am getting output on the power shell console (that could be because I am using write-output command). 
  Is there any way to write the single one page output to a file?
  I am struggling to find a way to out-file entire output to a file.  </p>
  
  <p>Below is the script.</p>
  
  <pre><code>$testpath = Test-Path "C:\test" 
  $testpath2 = test-path "C:\test"  
  $mcshieldk = Get-Service -Name mcshield | select Name  
  $internet = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\internet explorer").MkEnabled $hostname = hostname  Write-Host "hostname of comuter is" $hostname if (Test-Path $Machinetype)
  {}  
  else { Write-Host "internet is" $internet }  
  if ($testpath -eq $true -and $testpath2 -eq $true) 
   {  Write-Host "test and test1 folder exists" -ForegroundColor Green  }  
  else{ Write-Host "folder does not exists" -ForegroundColor Red  }  if($mcshield.Name -eq "mcshield") { Write-Host "mcshield service exists" }  
  else { Write-Host "mcshield does not exists"  }
  </code></pre>
  
  <p>Below is the console output</p>
  
  <pre><code>hostname of comuter is Server1
  internet is Yes
  test and test1 folder exists
  mcshield  does not exists
  </code></pre>