Example #1
0
 private Sku(string skuCode, ServerEditionType serverEdition, string name, InformationStoreSkuLimits informationStoreSkuLimits)
 {
     this.skuCode                   = skuCode;
     this.serverEdition             = serverEdition;
     this.name                      = name;
     this.informationStoreSkuLimits = informationStoreSkuLimits;
 }
Example #2
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            bool flag  = false;
            bool flag2 = false;
            InformationStoreSkuLimits informationStoreSkuLimits = null;
            IConfigurationSession     configurationSession      = (IConfigurationSession)base.DataSession;
            ExchangeServer            exchangeServer            = new ExchangeServer(this.DataObject);

            if (this.isErrorReportingChanged && this.oldErrorReporting != null && !this.oldErrorReporting.Value && (this.DataObject.ErrorReportingEnabled == null || this.DataObject.ErrorReportingEnabled.Value) && !base.ShouldContinue(Strings.ErrorReportingEnabledLegalMessage))
            {
                return;
            }
            if (this.ShouldGeneratePid())
            {
                this.DataObject.ProductID = this.ProductKey.GenerateProductID();
                this.DataObject.Edition   = this.ProductKey.Sku.ServerEdition;
                ADObjectId       childId          = this.DataObject.Id.GetChildId("InformationStore");
                InformationStore informationStore = configurationSession.Read <InformationStore>(childId);
                if (informationStore != null)
                {
                    informationStoreSkuLimits        = new InformationStoreSkuLimits(informationStore);
                    informationStore.MinAdminVersion = new int?(ExchangeObjectVersion.Exchange2007.ExchangeBuild.ToExchange2003FormatInt32());
                    informationStore.SetExchangeVersion(ExchangeObjectVersion.Exchange2007);
                    this.ProductKey.Sku.InformationStoreSkuLimits.UpdateInformationStore(informationStore);
                    configurationSession.Save(informationStore);
                    flag = true;
                }
            }
            if ((this.isDCChanged || this.isGCChanged || this.isCDCChanged || this.isExcludedDCChanged || this.isErrorReportingChanged) && !this.DataObject.IsProvisionedServer)
            {
                Exception ex = null;
                GetExchangeServer.SetConfigurationToRegistry(exchangeServer.Fqdn, exchangeServer.StaticDomainControllers, exchangeServer.StaticGlobalCatalogs, exchangeServer.StaticConfigDomainController ?? string.Empty, exchangeServer.StaticExcludedDomainControllers, exchangeServer.ErrorReportingEnabled, out ex);
                if (ex != null)
                {
                    base.WriteError(new InvalidOperationException(Strings.ErrorFaildToWriteRegistry(exchangeServer.Fqdn, ex.Message)), ErrorCategory.WriteError, this.Identity);
                }
                flag2 = true;
            }
            bool flag3 = false;

            try
            {
                if (this.DataObject.IsModified(ServerSchema.MonitoringGroup))
                {
                    bool useConfigNC      = configurationSession.UseConfigNC;
                    bool useGlobalCatalog = configurationSession.UseGlobalCatalog;
                    try
                    {
                        configurationSession.UseConfigNC      = false;
                        configurationSession.UseGlobalCatalog = true;
                        ADComputer adcomputer = ((ITopologyConfigurationSession)configurationSession).FindComputerByHostName(this.DataObject.Name);
                        if (adcomputer == null)
                        {
                            base.WriteError(new DirectoryObjectNotFoundException(this.DataObject.Id.ToString()), ErrorCategory.WriteError, this.Identity);
                        }
                        adcomputer.MonitoringGroup = this.DataObject.MonitoringGroup;
                        configurationSession.Save(adcomputer);
                    }
                    finally
                    {
                        configurationSession.UseConfigNC      = useConfigNC;
                        configurationSession.UseGlobalCatalog = useGlobalCatalog;
                    }
                }
                base.InternalProcessRecord();
                flag3 = true;
                if (flag)
                {
                    this.WriteWarning(Strings.ProductKeyRestartWarning);
                }
            }
            finally
            {
                if (!flag3)
                {
                    if (flag2)
                    {
                        Exception ex2 = null;
                        GetExchangeServer.SetConfigurationToRegistry(exchangeServer.Fqdn, this.oldDomainControllers, this.oldGlobalCatalogs, this.oldConfigDomainController ?? string.Empty, this.oldExcludedDomainControllers, new bool?(this.oldErrorReporting != null && this.oldErrorReporting.Value), out ex2);
                        if (ex2 != null)
                        {
                            this.WriteError(new InvalidOperationException(Strings.ErrorFaildToWriteRegistry(this.DataObject.Name, ex2.Message)), ErrorCategory.WriteError, this.Identity, false);
                        }
                    }
                    if (flag)
                    {
                        ADObjectId       childId2          = this.DataObject.Id.GetChildId("InformationStore");
                        InformationStore informationStore2 = configurationSession.Read <InformationStore>(childId2);
                        informationStoreSkuLimits.UpdateInformationStore(informationStore2);
                        configurationSession.Save(informationStore2);
                    }
                }
            }
            TaskLogger.LogExit();
        }