예제 #1
0
        private bool ShouldUpdateResourceSchemaAttributeId(ADSchemaVersion schemaVersion)
        {
            bool result = false;

            if (schemaVersion == ADSchemaVersion.Exchange2007Rtm)
            {
                ADSchemaAttributeObject[] array = this.configurationSession.Find <ADSchemaAttributeObject>(this.configurationSession.SchemaNamingContext, QueryScope.OneLevel, new AndFilter(new QueryFilter[]
                {
                    new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, "ms-exch-resource-property-schema"),
                    new ComparisonFilter(ComparisonOperator.Equal, ADSchemaAttributeSchema.AttributeID, "1.2.840.113556.1.4.7000.102.50329")
                }), null, 1);
                if (array.Length > 0)
                {
                    result = true;
                }
            }
            return(result);
        }
예제 #2
0
        protected override void PopulateContextVariables()
        {
            ADDomain addomain = ADForest.GetLocalForest().FindLocalDomain();

            if (addomain == null || addomain.Fqdn == null)
            {
                throw new InvalidFqdnException();
            }
            base.Fields["FullyQualifiedDomainName"] = addomain.Fqdn;
            if (this.PrepareSchema)
            {
                ADSchemaVersion schemaVersion = DirectoryUtilities.GetSchemaVersion(base.DomainController);
                switch (schemaVersion)
                {
                case ADSchemaVersion.Windows:
                    base.Fields["SchemaPrefix"] = "PostWindows2003_";
                    break;

                case ADSchemaVersion.Exchange2000:
                    base.Fields["SchemaPrefix"] = "PostExchange2000_";
                    break;

                case ADSchemaVersion.Exchange2003:
                case ADSchemaVersion.Exchange2007Rtm:
                    base.Fields["SchemaPrefix"] = "PostExchange2003_";
                    break;
                }
                base.Fields["UpdateResourcePropertySchema"]   = false;
                base.Fields["ResourcePropertySchemaSaveFile"] = Path.Combine(ConfigurationContext.Setup.SetupLoggingPath, "ResourcePropertySchema.xml");
                if (this.ShouldUpdateResourceSchemaAttributeId(schemaVersion))
                {
                    base.Fields["UpdateResourcePropertySchema"] = true;
                    base.WriteVerbose(Strings.WillSaveResourcePropertySchemaValue((string)base.Fields["ResourcePropertySchemaSaveFile"]));
                }
            }
            base.PopulateContextVariables();
        }
예제 #3
0
        public static ADSchemaVersion GetSchemaVersion(string domainControllerName)
        {
            IConfigurationSession configurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(domainControllerName, true, ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 339, "GetSchemaVersion", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Deployment\\DirectoryUtilities.cs");
            ADSchemaVersion       result = ADSchemaVersion.Unrecognized;

            try
            {
                ADSchemaAttributeObject[] array  = configurationSession.Find <ADSchemaAttributeObject>(DirectoryUtilities.ConfigurationSession.SchemaNamingContext, QueryScope.SubTree, new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, "ms-Exch-Schema-Version-Pt"), null, 1);
                ADSchemaAttributeObject[] array2 = configurationSession.Find <ADSchemaAttributeObject>(DirectoryUtilities.ConfigurationSession.SchemaNamingContext, QueryScope.SubTree, new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, "ms-Exch-Schema-Version-ADC"), null, 1);
                if (array.Length == 0 && array2.Length == 0)
                {
                    result = ADSchemaVersion.Windows;
                }
                else if (array.Length != 0)
                {
                    int num = array[0].RangeUpper ?? 0;
                    if (num >= 10637)
                    {
                        result = ADSchemaVersion.Exchange2007Rtm;
                    }
                    else if (num >= 6870)
                    {
                        result = ADSchemaVersion.Exchange2003;
                    }
                    else if (num >= 4397)
                    {
                        result = ADSchemaVersion.Exchange2000;
                    }
                }
            }
            catch (DataValidationException ex)
            {
                throw new ADInitializationException(Strings.SchemaVersionDataValidationException(ex.Message), ex);
            }
            return(result);
        }