title: PowerShell 2.0 and how to handle exceptions?
body: <p>Why I get error message printed on the console when running these two simple samples ? 
  I want that I get "Error testing :)" printed on the console insted of:</p>
  
  <blockquote>
    <p>Get-WmiObject : The RPC server is
    unavailable. (Exception from HRESULT:
    0x800706BA) At line:3 char:15
    +     Get-WmiObject &lt;&lt;&lt;&lt;  -ComputerName possibly.nonexisting.domain.com
    -Credential (Get-Credential) -Class Win32_logicaldisk 
        + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject],
    COMException
        + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand</p>
  </blockquote>
  
  <p>or</p>
  
  <blockquote>
    <p>Attempted to divide by zero. At line:3
    char:13
    +         $i = 1/ &lt;&lt;&lt;&lt; 0<br>
        + CategoryInfo          : NotSpecified: (:) [],
    ParentContainsErrorRecordException
        + FullyQualifiedErrorId : RuntimeException</p>
  </blockquote>
  
  <p>First example:</p>
  
  <pre><code>try
  {
      $i = 1/0   
      Write-Host $i     
  }
  catch [Exception]
  { 
      Write-Host "Error testing :)" 
  }
  </code></pre>
  
  <p>Second example:</p>
  
  <pre><code>try
  {
      Get-WmiObject -ComputerName possibly.nonexisting.domain.com -Credential (Get-Credential) -Class Win32_logicaldisk 
  }
  catch [Exception]
  { 
      Write-Host "Error testing :)" 
  }
  </code></pre>
  
  <p>Thank you very much!</p>