title: Try, catch : doing something if the TRY completed successfully
body: <p>I am looping through a list of samaccountnames and performing several actions: </p>
  
  <pre><code># Disabling user
  try {    
      Disable-QADUser $user | Out-Null
  } catch [exception] {
      "Disable-QADuser: " + $($_.Exception.Message) | out-file $logfile -append
      write-host " - Error disabling useraccount." -fore yellow
  }
  
  # Set informative description
  try {    
      Set-QADuser $user -Description "Disabled $now"  | Out-Null
  } catch [exception] {
      "Set-QADuser: " + $($_.Exception.Message)| out-file $logfile -append
      write-host " - Error setting informative description in AD." -fore yellow
  } 
  </code></pre>
  
  <p>But how do I output something if the command completed successfully? Something like</p>
  
  <pre><code>write-host "User $user disabled"
  "User $user disabled" | out-file $logfile -append
  </code></pre>
  
  <p>All help/pointers are greatly appreciated!</p>
  
  <p><strong>EDIT</strong>
  I noticed that I can use <code>tee-object</code> to send the output to file as well as console.. This way I do not have to have to lines to "tee" the output:)</p>