예제 #1
0
        public static bool TryGetLocalDomainConfigVersion(out int domainConfigVersion)
        {
            domainConfigVersion = 0;
            bool result = false;
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 484, "TryGetLocalDomainConfigVersion", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Deployment\\DirectoryUtilities.cs");

            topologyConfigurationSession.UseConfigNC = false;
            ADDomain addomain = ADForest.GetLocalForest().FindLocalDomain();

            if (addomain == null)
            {
                throw new ADInitializationException(Strings.LocalDomainNotFoundException);
            }
            MesoContainer mesoContainer = topologyConfigurationSession.FindMesoContainer(addomain);

            if (mesoContainer != null)
            {
                ValidationError validationError;
                if (!DirectoryUtilities.IsPropertyValid(mesoContainer, MesoContainerSchema.ObjectVersion, out validationError))
                {
                    throw new ADInitializationException(Strings.MesoVersionInvalidException(validationError.Description));
                }
                domainConfigVersion = mesoContainer.ObjectVersion;
                result = true;
            }
            return(result);
        }
예제 #2
0
        public static bool IsLocalDomainConfigUpToDate()
        {
            bool     result   = false;
            bool     flag     = false;
            int      num      = 0;
            ADDomain addomain = ADForest.GetLocalForest().FindLocalDomain();

            if (addomain == null)
            {
                throw new ADInitializationException(Strings.LocalDomainNotFoundException);
            }
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 531, "IsLocalDomainConfigUpToDate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Deployment\\DirectoryUtilities.cs");

            topologyConfigurationSession.UseConfigNC = false;
            MesoContainer mesoContainer = topologyConfigurationSession.FindMesoContainer(addomain);

            if (mesoContainer != null)
            {
                flag = true;
                ValidationError validationError;
                if (!DirectoryUtilities.IsPropertyValid(mesoContainer, MesoContainerSchema.ObjectVersion, out validationError))
                {
                    throw new ADInitializationException(Strings.MesoVersionInvalidException(validationError.Description));
                }
                num = mesoContainer.ObjectVersion;
            }
            if (flag && num >= MesoContainer.DomainPrepVersion)
            {
                topologyConfigurationSession.UseGlobalCatalog = true;
                ADGroup adgroup = topologyConfigurationSession.ResolveWellKnownGuid <ADGroup>(WellKnownGuid.ExSWkGuid, topologyConfigurationSession.ConfigurationNamingContext);
                topologyConfigurationSession.UseGlobalCatalog = false;
                if (adgroup != null)
                {
                    ActiveDirectoryAccessRule activeDirectoryAccessRule = new ActiveDirectoryAccessRule(adgroup.Sid, ActiveDirectoryRights.DeleteTree, AccessControlType.Deny, ActiveDirectorySecurityInheritance.All);
                    result = DirectoryCommon.FindAces(mesoContainer, new ActiveDirectoryAccessRule[]
                    {
                        activeDirectoryAccessRule
                    });
                }
            }
            return(result);
        }
예제 #3
0
 public static ADGroup FindE12DomainServersGroup(IRecipientSession recipSession, MesoContainer meso)
 {
     return(recipSession.Read(meso.Id.GetChildId("Exchange Install Domain Servers")) as ADGroup);
 }