public static MRSHealthCheckOutcome VerifyServiceIsUp(string serverName, string fqdn, TestMRSHealth testMRSCmdlet = null) { MRSHealthCheckOutcome result; try { using (ManagementObject serviceObject = WmiWrapper.GetServiceObject(fqdn, "MSExchangeMailboxReplication")) { if (serviceObject == null) { if (testMRSCmdlet != null) { testMRSCmdlet.MonitoringData.Events.Add(new MonitoringEvent("MSExchange Monitoring MRSHealth", 1001, EventTypeEnumeration.Error, Strings.MailboxReplicationServiceNotInstalled)); } result = new MRSHealthCheckOutcome(serverName, MRSHealthCheckId.ServiceCheck, false, Strings.MailboxReplicationServiceNotInstalled); } else if (!StringComparer.InvariantCultureIgnoreCase.Equals(serviceObject["State"] as string, "Running")) { if (testMRSCmdlet != null) { testMRSCmdlet.MonitoringData.Events.Add(new MonitoringEvent("MSExchange Monitoring MRSHealth", 1001, EventTypeEnumeration.Error, Strings.MailboxReplicationServiceNotRunning)); } result = new MRSHealthCheckOutcome(serverName, MRSHealthCheckId.ServiceCheck, false, Strings.MailboxReplicationServiceNotRunning); } else { result = new MRSHealthCheckOutcome(serverName, MRSHealthCheckId.ServiceCheck, true, Strings.MailboxReplicationServiceIsRunning); } } } catch (WmiException ex) { ServiceHealthWmiFailureException ex2 = new ServiceHealthWmiFailureException(ex.Message, ex); if (testMRSCmdlet != null) { testMRSCmdlet.WriteErrorAndMonitoringEvent(ex2, ErrorCategory.ReadError, 1001); } result = new MRSHealthCheckOutcome(serverName, MRSHealthCheckId.ServiceCheck, false, CommonUtils.FullExceptionMessage(ex2, true)); } return(result); }
public static MRSHealthCheckOutcome VerifyServiceIsRespondingToRPCPing(string serverName, TestMRSHealth testMRSCmdlet = null) { MRSHealthCheckOutcome outcome = null; CommonUtils.CatchKnownExceptions(delegate { MailboxReplicationServiceClient mailboxReplicationServiceClient2; MailboxReplicationServiceClient mailboxReplicationServiceClient = mailboxReplicationServiceClient2 = MailboxReplicationServiceClient.Create(serverName); try { outcome = new MRSHealthCheckOutcome(serverName, MRSHealthCheckId.RPCPingCheck, true, Strings.MailboxReplicationServiceIsRespondingToRPCPing(mailboxReplicationServiceClient.ServerVersion.ToString())); } finally { if (mailboxReplicationServiceClient2 != null) { ((IDisposable)mailboxReplicationServiceClient2).Dispose(); } } }, delegate(Exception ex) { if (testMRSCmdlet != null) { testMRSCmdlet.MonitoringData.Events.Add(new MonitoringEvent("MSExchange Monitoring MRSHealth", 1002, EventTypeEnumeration.Error, Strings.MailboxReplicationServiceNotResponding(CommonUtils.FullExceptionMessage(ex, true)))); } outcome = new MRSHealthCheckOutcome(serverName, MRSHealthCheckId.RPCPingCheck, false, Strings.MailboxReplicationServiceNotResponding(CommonUtils.FullExceptionMessage(ex, true))); }); return(outcome); }
public static MRSHealthCheckOutcome VerifyMRSProxyIsRespondingToWCFPing(string mrsServer, string mrsProxyServer, NetworkCredential credentials, TestMRSHealth testMRSCmdlet = null) { MRSHealth.< > c__DisplayClass7 CS$ < > 8__locals1 = new MRSHealth.< > c__DisplayClass7(); CS$ < > 8__locals1.mrsServer = mrsServer; CS$ < > 8__locals1.mrsProxyServer = mrsProxyServer; CS$ < > 8__locals1.credentials = credentials; CS$ < > 8__locals1.testMRSCmdlet = testMRSCmdlet; if (CS$ < > 8__locals1.mrsProxyServer == null) { CS$ < > 8__locals1.mrsProxyServer = CS$ < > 8__locals1.mrsServer; } CS$ < > 8__locals1.outcome = null; using (MailboxReplicationServiceClient mrsClient = MailboxReplicationServiceClient.Create(CS$ < > 8__locals1.mrsServer, MRSCapabilities.MrsProxyPing)) { CommonUtils.CatchKnownExceptions(delegate { if (CS$ < > 8__locals1.credentials != null) { mrsClient.PingMRSProxy(CS$ < > 8__locals1.mrsProxyServer, CS$ < > 8__locals1.credentials.UserName, CS$ < > 8__locals1.credentials.Password, CS$ < > 8__locals1.credentials.Domain, true); }