/// <summary>
        /// Initialize method implementation
        /// </summary>
        internal static void Initialize(PSHost host = null, bool loadconfig = false)
        {
            if (ADFSManager == null)
            {
                ADFSManager = new ADFSServiceManager();
                ADFSManager.Initialize();
            }
            if (MailslotServer == null)
            {
                MailslotServer = new MailSlotServer("MGT");
                MailslotServer.MailSlotMessageArrived += MailSlotMessageArrived;
                MailslotServer.AllowToSelf             = true;
                MailslotServer.Start();
            }

            if (loadconfig)
            {
                try
                {
                    ADFSManager.EnsureLocalConfiguration(host);
                }
                catch (CmdletInvocationException cm)
                {
                    EventLog.WriteEntry(EventLogSource, SErrors.ErrorMFAUnAuthorized + "\r\r" + cm.Message, EventLogEntryType.Error, 30901);
                    throw cm;
                }
                catch (Exception ex)
                {
                    EventLog.WriteEntry(EventLogSource, string.Format(SErrors.ErrorLoadingMFAConfiguration, ex.Message), EventLogEntryType.Error, 30900);
                    throw ex;
                }
            }
        }
 /// <summary>
 /// MailSlotMessageArrived method implmentation
 /// </summary>
 private static void MailSlotMessageArrived(MailSlotServer maislotserver, MailSlotMessage message)
 {
     if (message.Operation == (byte)NotificationsKind.ConfigurationReload)
     {
         ADFSManager.Config = null;
         ADFSManager.EnsureLocalConfiguration(null); // Force Reload Configuration
     }
     else if (message.Operation == (byte)NotificationsKind.ServiceStatusRunning)
     {
         ADFSManager.ServicesStatus = ServiceOperationStatus.OperationRunning;
         ADFSManager.OnServiceStatusChanged(ADFSManager.ServicesStatus, message.Text);
     }
     else if (message.Operation == (byte)NotificationsKind.ServiceStatusStopped)
     {
         ADFSManager.ServicesStatus = ServiceOperationStatus.OperationStopped;
         ADFSManager.OnServiceStatusChanged(ADFSManager.ServicesStatus, message.Text);
     }
     else if (message.Operation == (byte)NotificationsKind.ServiceStatusPending)
     {
         ADFSManager.ServicesStatus = ServiceOperationStatus.OperationPending;
         ADFSManager.OnServiceStatusChanged(ADFSManager.ServicesStatus, message.Text);
     }
     else if (message.Operation == (byte)NotificationsKind.ServiceStatusInError)
     {
         ADFSManager.ServicesStatus = ServiceOperationStatus.OperationInError;
         ADFSManager.OnServiceStatusChanged(ADFSManager.ServicesStatus, message.Text);
     }
 }
 /// <summary>
 /// MailSlotMessageArrived method implmentation
 /// </summary>
 private static void MailSlotMessageArrived(MailSlotServer maislotserver, MailSlotMessage message)
 {
     if (message.Operation == 0xAA)
     {
         ADFSManager.Config = null;
         ADFSManager.EnsureLocalConfiguration(null); // Force Reload Configuration
         MailslotServer.AllowedMachines.Clear();
         foreach (ADFSServerHost svr in Config.Hosts.ADFSFarm.Servers)
         {
             MailslotServer.AllowedMachines.Add(svr.MachineName);
         }
     }
     else if (message.Operation == 0x10)
     {
         ADFSManager.ServicesStatus = ServiceOperationStatus.OperationRunning;
         ADFSManager.OnServiceStatusChanged(ADFSManager.ServicesStatus, message.Text);
     }
     else if (message.Operation == 0x11)
     {
         ADFSManager.ServicesStatus = ServiceOperationStatus.OperationStopped;
         ADFSManager.OnServiceStatusChanged(ADFSManager.ServicesStatus, message.Text);
     }
     else if (message.Operation == 0x12)
     {
         ADFSManager.ServicesStatus = ServiceOperationStatus.OperationPending;
         ADFSManager.OnServiceStatusChanged(ADFSManager.ServicesStatus, message.Text);
     }
     else if (message.Operation == 0x19)
     {
         ADFSManager.ServicesStatus = ServiceOperationStatus.OperationInError;
         ADFSManager.OnServiceStatusChanged(ADFSManager.ServicesStatus, message.Text);
     }
 }