/// <summary>
        /// Update method implmentation
        /// </summary>
        public void Load(PSHost host)
        {
            ManagementAdminService.Initialize(host, true);
            MFAConfig cfg  = ManagementAdminService.ADFSManager.ReadConfiguration(host);
            SendMail  mail = cfg.SendMail;

            IsDirty  = cfg.IsDirty;
            From     = mail.From;
            UserName = mail.UserName;
            Password = mail.Password;
            Host     = mail.Host;
            Port     = mail.Port;
            UseSSL   = mail.UseSSL;
            Company  = mail.Company;
            MailOTPContent.Clear();
            foreach (SendMailFileName itm in mail.MailOTPContent)
            {
                MailOTPContent.Add((MMCConfigMailFileName)itm);
            }
            MailAdminContent.Clear();
            foreach (SendMailFileName itm in mail.MailAdminContent)
            {
                MailAdminContent.Add((MMCConfigMailFileName)itm);
            }
            MailKeyContent.Clear();
            foreach (SendMailFileName itm in mail.MailKeyContent)
            {
                MailKeyContent.Add((MMCConfigMailFileName)itm);
            }
        }
        /// <summary>
        /// Update method implmentation
        /// </summary>
        public void Update(PSHost host)
        {
            ManagementAdminService.Initialize(true);
            MFAConfig cfg  = ManagementAdminService.ADFSManager.Config;
            SendMail  mail = cfg.SendMail;

            cfg.IsDirty   = IsDirty;
            mail.From     = From;
            mail.UserName = UserName;
            mail.Password = Password;
            mail.Host     = Host;
            mail.Port     = Port;
            mail.UseSSL   = UseSSL;
            mail.Company  = Company;
            mail.MailOTPContent.Clear();
            foreach (MMCConfigMailFileName itm in MailOTPContent)
            {
                mail.MailOTPContent.Add((SendMailFileName)itm);
            }
            mail.MailAdminContent.Clear();
            foreach (MMCConfigMailFileName itm in MailAdminContent)
            {
                mail.MailAdminContent.Add((SendMailFileName)itm);
            }
            mail.MailKeyContent.Clear();
            foreach (MMCConfigMailFileName itm in MailKeyContent)
            {
                mail.MailKeyContent.Add((SendMailFileName)itm);
            }
            ManagementAdminService.ADFSManager.WriteConfiguration(host);
            using (MailSlotClient mailslot = new MailSlotClient())
            {
                mailslot.SendNotification(0xAA);
            }
        }
        /// <summary>
        /// Update method implmentation
        /// </summary>
        public void Update(PSHost host)
        {
            ManagementAdminService.Initialize(true);
            MFAConfig cfg = ManagementAdminService.ADFSManager.Config;

            cfg.AdminContact         = AdminContact;
            cfg.IsDirty              = IsDirty;
            cfg.RefreshScan          = RefreshScan;
            cfg.DeliveryWindow       = DeliveryWindow;
            cfg.TOTPShadows          = TOTPShadows;
            cfg.MailEnabled          = MailEnabled;
            cfg.SMSEnabled           = SMSEnabled;
            cfg.AppsEnabled          = AppsEnabled;
            cfg.Algorithm            = Algorithm;
            cfg.Issuer               = Issuer;
            cfg.UseActiveDirectory   = UseActiveDirectory;
            cfg.CustomUpdatePassword = CustomUpdatePassword;
            cfg.DefaultCountryCode   = DefaultCountryCode;
            cfg.AdminContact         = AdminContact;
            cfg.UserFeatures         = UserFeatures;
            cfg.AdvertisingDays      = AdvertisingDays;
            ManagementAdminService.ADFSManager.WriteConfiguration(host);
            using (MailSlotClient mailslot = new MailSlotClient())
            {
                mailslot.SendNotification(0xAA);
            }
        }
        /// <summary>
        /// Update method implmentation
        /// </summary>
        public void Update(PSHost host)
        {
            ManagementAdminService.Initialize(true);
            MFAConfig cfg  = ManagementAdminService.ADFSManager.Config;
            ADDSHost  adds = cfg.Hosts.ActiveDirectoryHost;

            cfg.IsDirty                   = IsDirty;
            adds.Account                  = Account;
            adds.Password                 = adds.Password;
            adds.DomainAddress            = adds.DomainAddress;
            adds.keyAttribute             = KeyAttribute;
            adds.mailAttribute            = MailAttribute;
            adds.methodAttribute          = MethodAttribute;
            adds.notifcheckdateattribute  = NotifCheckDateAttribute;
            adds.notifcreatedateAttribute = NotifCreateDateAttribute;
            adds.notifvalidityAttribute   = NotifValidityAttribute;
            adds.phoneAttribute           = PhoneAttribute;
            adds.totpAttribute            = TOTPAttribute;
            adds.totpEnabledAttribute     = TOTPEnabledAttribute;
            ManagementAdminService.ADFSManager.WriteConfiguration(host);
            using (MailSlotClient mailslot = new MailSlotClient())
            {
                mailslot.SendNotification(0xAA);
            }
        }
        /// <summary>
        /// Update method implmentation
        /// </summary>
        public void Load(PSHost host)
        {
            ManagementAdminService.Initialize(host, true);
            MFAConfig     cfg = ManagementAdminService.ADFSManager.ReadConfiguration(host);
            SQLServerHost sql = cfg.Hosts.SQLServerHost;

            IsDirty          = cfg.IsDirty;
            ConnectionString = sql.ConnectionString;
        }
        public void Load(PSHost host)
        {
            ManagementAdminService.Initialize(host, true);
            MFAConfig     cfg = ManagementAdminService.ADFSManager.ReadConfiguration(host);
            MFAKeysConfig otp = cfg.KeysConfig;

            this.FullQualifiedImplementation = otp.ExternalKeyManager.FullQualifiedImplementation;
            this.Parameters = otp.ExternalKeyManager.Parameters;
        }
        /// <summary>
        /// Update method implmentation
        /// </summary>
        public void Update(PSHost host)
        {
            ManagementAdminService.Initialize(true);
            MFAConfig     cfg = ManagementAdminService.ADFSManager.Config;
            SQLServerHost sql = cfg.Hosts.SQLServerHost;

            cfg.IsDirty          = IsDirty;
            sql.ConnectionString = ConnectionString;
            ManagementAdminService.ADFSManager.WriteConfiguration(host);
            using (MailSlotClient mailslot = new MailSlotClient())
            {
                mailslot.SendNotification(0xAA);
            }
        }
        /// <summary>
        /// Update method implmentation
        /// </summary>
        public void Load(PSHost host)
        {
            ManagementAdminService.Initialize(host, true);
            MFAConfig           cfg = ManagementAdminService.ADFSManager.ReadConfiguration(host);
            ExternalOTPProvider otp = cfg.ExternalOTPProvider;

            this.IsDirty = cfg.IsDirty;
            this.Company = otp.Company;
            this.FullQualifiedImplementation = otp.FullQualifiedImplementation;
            this.IsTwoWay   = otp.IsTwoWay;
            this.Sha1Salt   = otp.Sha1Salt;
            this.Timeout    = otp.Timeout;
            this.Parameters = otp.Parameters;
        }
        /// <summary>
        /// Update method implmentation
        /// </summary>
        public void Update(PSHost host)
        {
            ManagementAdminService.Initialize(true);
            MFAConfig     cfg = ManagementAdminService.ADFSManager.Config;
            MFAKeysConfig otp = cfg.KeysConfig;

            otp.ExternalKeyManager.FullQualifiedImplementation = this.FullQualifiedImplementation;
            otp.ExternalKeyManager.Parameters = this.Parameters;
            ManagementAdminService.ADFSManager.WriteConfiguration(host);
            using (MailSlotClient mailslot = new MailSlotClient())
            {
                mailslot.SendNotification(0xAA);
            }
        }
        /// <summary>
        /// Update method implmentation
        /// </summary>
        public void Load(PSHost host)
        {
            ManagementAdminService.Initialize(host, true);
            MFAConfig     cfg  = ManagementAdminService.ADFSManager.ReadConfiguration(host);
            MFAKeysConfig keys = cfg.KeysConfig;

            IsDirty = cfg.IsDirty;
            this.CertificateThumbprint = keys.CertificateThumbprint;
            this.CertificateValidity   = keys.CertificateValidity;
            this.KeyFormat             = keys.KeyFormat;
            this.KeyGenerator          = keys.KeyGenerator;
            this.KeySize            = keys.KeySize;
            this.ExternalKeyManager = (MMCExternalKeyManager)keys.ExternalKeyManager;
        }
        /// <summary>
        /// Update method implmentation
        /// </summary>
        public void Update(PSHost host)
        {
            ManagementAdminService.Initialize(true);
            MFAConfig           cfg = ManagementAdminService.ADFSManager.Config;
            ExternalOTPProvider otp = cfg.ExternalOTPProvider;

            cfg.IsDirty = true;
            otp.Company = this.Company;
            otp.FullQualifiedImplementation = this.FullQualifiedImplementation;
            otp.IsTwoWay   = this.IsTwoWay;
            otp.Sha1Salt   = this.Sha1Salt;
            otp.Timeout    = this.Timeout;
            otp.Parameters = this.Parameters;
            ManagementAdminService.ADFSManager.WriteConfiguration(host);
            using (MailSlotClient mailslot = new MailSlotClient())
            {
                mailslot.SendNotification(0xAA);
            }
        }
        /// <summary>
        /// Update method implmentation
        /// </summary>
        public void Update(PSHost host)
        {
            ManagementAdminService.Initialize(true);
            MFAConfig     cfg  = ManagementAdminService.ADFSManager.Config;
            MFAKeysConfig keys = cfg.KeysConfig;

            cfg.IsDirty = true;
            keys.CertificateThumbprint = this.CertificateThumbprint;
            keys.CertificateValidity   = this.CertificateValidity;
            keys.KeyFormat             = this.KeyFormat;
            keys.KeyGenerator          = this.KeyGenerator;
            keys.KeySize            = this.KeySize;
            keys.ExternalKeyManager = (MFAExternalKeyManager)this.ExternalKeyManager;
            ManagementAdminService.ADFSManager.WriteConfiguration(host);
            using (MailSlotClient mailslot = new MailSlotClient())
            {
                mailslot.SendNotification(0xAA);
            }
        }
        /// <summary>
        /// Update method implmentation
        /// </summary>
        public void Load(PSHost host)
        {
            ManagementAdminService.Initialize(host, true);
            MFAConfig cfg  = ManagementAdminService.ADFSManager.ReadConfiguration(host);
            ADDSHost  adds = cfg.Hosts.ActiveDirectoryHost;

            IsDirty                  = cfg.IsDirty;
            Account                  = adds.Account;
            Password                 = adds.Password;
            DomainAddress            = adds.DomainAddress;
            KeyAttribute             = adds.keyAttribute;
            MailAttribute            = adds.mailAttribute;
            MethodAttribute          = adds.methodAttribute;
            NotifCheckDateAttribute  = adds.notifcheckdateattribute;
            NotifCreateDateAttribute = adds.notifcreatedateAttribute;
            NotifValidityAttribute   = adds.notifvalidityAttribute;
            PhoneAttribute           = adds.phoneAttribute;
            TOTPAttribute            = adds.totpAttribute;
            TOTPEnabledAttribute     = adds.totpEnabledAttribute;
        }
        /// <summary>
        /// Update method implmentation
        /// </summary>
        public void Load(PSHost host)
        {
            ManagementAdminService.Initialize(host, true);
            MFAConfig cfg = ManagementAdminService.ADFSManager.ReadConfiguration(host);

            AdminContact         = cfg.AdminContact;
            IsDirty              = cfg.IsDirty;
            RefreshScan          = cfg.RefreshScan;
            DeliveryWindow       = cfg.DeliveryWindow;
            TOTPShadows          = cfg.TOTPShadows;
            MailEnabled          = cfg.MailEnabled;
            SMSEnabled           = cfg.SMSEnabled;
            AppsEnabled          = cfg.AppsEnabled;
            Algorithm            = cfg.Algorithm;
            Issuer               = cfg.Issuer;
            UseActiveDirectory   = cfg.UseActiveDirectory;
            CustomUpdatePassword = cfg.CustomUpdatePassword;
            DefaultCountryCode   = cfg.DefaultCountryCode;
            AdminContact         = cfg.AdminContact;
            UserFeatures         = cfg.UserFeatures;
            AdvertisingDays      = cfg.AdvertisingDays;
        }
        /// <summary>
        /// SetTemplate method implmentation
        /// </summary>
        public void SetTemplate(PSHost host, MMCTemplateMode mode)
        {
            ManagementAdminService.Initialize(true);
            MFAConfig cfg = ManagementAdminService.ADFSManager.Config;

            switch (mode)
            {
            case MMCTemplateMode.Free:
                cfg.UserFeatures = (UserFeaturesOptions.BypassDisabled | UserFeaturesOptions.BypassUnRegistered | UserFeaturesOptions.AllowManageOptions | UserFeaturesOptions.AllowChangePassword);
                break;

            case MMCTemplateMode.Open:
                cfg.UserFeatures = (UserFeaturesOptions.BypassDisabled | UserFeaturesOptions.AllowUnRegistered | UserFeaturesOptions.AllowManageOptions | UserFeaturesOptions.AllowChangePassword);
                break;

            case MMCTemplateMode.Default:
                cfg.UserFeatures = (UserFeaturesOptions.AllowDisabled | UserFeaturesOptions.AllowUnRegistered | UserFeaturesOptions.AllowManageOptions | UserFeaturesOptions.AllowChangePassword);
                break;

            case MMCTemplateMode.Managed:
                cfg.UserFeatures = (UserFeaturesOptions.AllowDisabled | UserFeaturesOptions.AllowUnRegistered | UserFeaturesOptions.AllowProvideInformations | UserFeaturesOptions.AllowChangePassword);
                break;

            case MMCTemplateMode.Strict:
                cfg.UserFeatures = (UserFeaturesOptions.AllowProvideInformations);
                break;

            case MMCTemplateMode.Administrative:
                cfg.UserFeatures = (UserFeaturesOptions.AdministrativeMode);
                break;
            }
            ManagementAdminService.ADFSManager.WriteConfiguration(host);
            using (MailSlotClient mailslot = new MailSlotClient())
            {
                mailslot.SendNotification(0xAA);
            }
        }