title: Error handling 0x800706BA - RPC-Server not found
body: <p>I have written a script to get the OSVersion from a List of Servers. Some Servers don´t respond to the "<code>Get-WmiObject</code>" command.<br>
  I want a list of all Hostnames where this error occurs.</p>
  
  <p>This gives me an list of the first few Servers with this error.<br>
  When the first Server is responding with no error, the script stops. </p>
  
  <p>I want the script to do nothing and continue when a Server isn´t sending an error. </p>
  
  <p>Has anybody an idea how to solve this problem.</p>
  
  <p>Thanks in advance.</p>
  
  <p>I tried to set "-ErrorAction continue" but then the whole script doesn´t run.</p>
  
  <pre><code>Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force
  $arraylist_OSInfo = New-Object System.Collections.ArrayList
  $file=Get-Content -Path "C:\Temp\PS-Skripte\server2.txt"
  foreach ($Hostname in $file)
   {
      try
      {
          Get-WmiObject Win32_OperatingSystem -ComputerName $Hostname -ErrorAction Stop
      }
  
      catch [Exception]
      {
          if ($_.Exception.GetType().Name -eq "COMException")
          {
            echo "$Hostname - RPC Error" | Out-File -FilePath "C:\temp\PS-Skripte\RPCerror.log" -Append -encoding unicode  
          }
      }
  }
  </code></pre>
  
  <p>I expect to get a list of hostnames from all server who are sending the Error:</p>
  
  <blockquote>
  <pre><code>"Get-WmiObject : Der RPC-Server ist nicht verfügbar. (Ausnahme von HRESULT: 0x800706BA)"
  </code></pre>
  </blockquote>
  
  <p>as answer of the cmdlet "Get-WmiObject"</p>