protected void ShutdownHost(VSphereServer server)
 {
     try
     {
         Vim25Client client = new Vim25Client(server.Host, server.Username, server.Password);
         client.LogUserEvent("HostSystem", "ha-host", "Shutdown Test");
         client.ShutdownHost_Task(true);
         Logger.WriteLogEntry(String.Format("Host {0} shutdown initiated", server.Name), EventLogEntryType.Information);
     }
     catch (WebException ex)
     {
         if (ex.Response is HttpWebResponse)
         {
             HttpWebResponse response = ex.Response as HttpWebResponse;
             if (response.StatusCode == HttpStatusCode.InternalServerError)
             {
                 string xml = new System.IO.StreamReader(ex.Response.GetResponseStream()).ReadToEnd();
                 Console.Write(xml);
                 Logger.WriteLogEntry(String.Format("Host {0} shutdown failed\n\nReturned XML:\n{1}", server.Name, xml), EventLogEntryType.Error);
                 return;
             }
         }
         else
         {
             Logger.WriteLogEntry("HTTP Exception caught attempting host shutdown\n\nException details:\n" + ex.ToString(), EventLogEntryType.Error);
         }
         Console.Write(ex.ToString());
     }
     catch (Exception ex)
     {
         Console.Write(ex.ToString());
         Logger.WriteLogEntry("Exception caught attempting host shutdown\n\nException details:\n" + ex.ToString(), EventLogEntryType.Error);
     }
 }
 protected void ShutdownHost(VSphereServer server)
 {
     try
     {
         Vim25Client client = new Vim25Client(server.Host, server.Username, server.Password);
         client.LogUserEvent("HostSystem", "ha-host", "Shutdown Test");
         client.ShutdownHost_Task(true);
         Logger.WriteLogEntry(String.Format("Host {0} shutdown initiated", server.Name), EventLogEntryType.Information);
     }
     catch (WebException ex)
     {
         if (ex.Response is HttpWebResponse)
         {
             HttpWebResponse response = ex.Response as HttpWebResponse;
             if (response.StatusCode == HttpStatusCode.InternalServerError)
             {
                 string xml = new System.IO.StreamReader(ex.Response.GetResponseStream()).ReadToEnd();
                 Console.Write(xml);
                 Logger.WriteLogEntry(String.Format("Host {0} shutdown failed\n\nReturned XML:\n{1}", server.Name, xml), EventLogEntryType.Error);
                 return;
             }
         }
         else
         {
             Logger.WriteLogEntry("HTTP Exception caught attempting host shutdown\n\nException details:\n" + ex.ToString(), EventLogEntryType.Error);
         }
         Console.Write(ex.ToString());
     }
     catch (Exception ex)
     {
         Console.Write(ex.ToString());
         Logger.WriteLogEntry("Exception caught attempting host shutdown\n\nException details:\n" + ex.ToString(), EventLogEntryType.Error);
     }
 }