Пример #1
0
        private bool TryGetNewestCookieFromAllDomainControllers(out Cookie latestCookie, out string cookieTimeStampRecordInfo)
        {
            latestCookie = null;
            cookieTimeStampRecordInfo = null;
            bool            result      = false;
            ADForest        localForest = ADForest.GetLocalForest();
            List <ADServer> list        = localForest.FindAllGlobalCatalogsInLocalSite();

            if (list != null && list.Count > 0)
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.AppendLine("List of cookie timestamp from all DCs:");
                foreach (ADServer adserver in list)
                {
                    IConfigurationSession session = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(adserver.DnsHostName, true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 593, "TryGetNewestCookieFromAllDomainControllers", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\transport\\EdgeSync\\TestEdgeSyncBase.cs");
                    Cookie cookie;
                    if (this.TryReadCookie(session, out cookie))
                    {
                        result = true;
                        if (cookie != null)
                        {
                            if (latestCookie == null || cookie.LastUpdated > latestCookie.LastUpdated)
                            {
                                latestCookie = cookie;
                            }
                            stringBuilder.AppendFormat("TimeStamp:{0}, SessionDC:{1}, CookieDC:{2};\r\n", cookie.LastUpdated, adserver.Name, cookie.DomainController);
                        }
                        else
                        {
                            stringBuilder.AppendFormat("Cookie Value Not Found On DC {0};\r\n", adserver.Name);
                        }
                    }
                    else
                    {
                        stringBuilder.AppendFormat("Failed Accessing Domain Controller {0};\r\n", adserver.Name);
                    }
                }
                cookieTimeStampRecordInfo = stringBuilder.ToString();
            }
            return(result);
        }
Пример #2
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            base.CreateParentContainerIfNeeded(this.DataObject);
            if (CommonConstants.UseDataCenterCallRouting)
            {
                this.DataObject.PhoneContext = base.Name + "." + Guid.NewGuid().ToString("D");
            }
            else
            {
                this.DataObject.PhoneContext = base.Name + "." + ADForest.GetLocalForest().Fqdn;
            }
            if (this.DataObject.SubscriberType == UMSubscriberType.Consumer)
            {
                this.DataObject.CallSomeoneEnabled  = false;
                this.DataObject.SendVoiceMsgEnabled = false;
            }
            this.DataObject.AudioCodec = AudioCodecEnum.Mp3;
            UMMailboxPolicy ummailboxPolicy = null;

            if (base.Fields["GenerateUMMailboxPolicy"] == null || (bool)base.Fields["GenerateUMMailboxPolicy"])
            {
                base.DataSession.Save(this.DataObject);
                ummailboxPolicy = this.AutoGeneratePolicy();
            }
            base.InternalProcessRecord();
            if (!base.HasErrors)
            {
                UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_NewDialPlanCreated, null, new object[]
                {
                    base.Name
                });
            }
            else if (ummailboxPolicy != null)
            {
                base.DataSession.Delete(ummailboxPolicy);
                base.DataSession.Delete(this.DataObject);
            }
            TaskLogger.LogExit();
        }
Пример #3
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (this.OrganizationalUnit != null)
     {
         this.organizationalUnit = (ExtendedOrganizationalUnit)base.GetDataObject <ExtendedOrganizationalUnit>(this.OrganizationalUnit, this.ConfigurationSession, null, null, new LocalizedString?(Strings.ErrorManagementObjectAmbiguous(this.OrganizationalUnit.ToString())));
         this.rootId             = this.organizationalUnit.Id;
     }
     if (this.IncludeDomainLocalFrom != null)
     {
         this.includeDomainLocalFrom = ADForest.GetLocalForest(this.ConfigurationSession.DomainController).FindDomainByFqdn(this.IncludeDomainLocalFrom.Domain);
         if (this.includeDomainLocalFrom == null)
         {
             base.WriteError(new DomainNotFoundException(this.IncludeDomainLocalFrom.Domain), ErrorCategory.InvalidArgument, this.IncludeDomainLocalFrom);
             TaskLogger.LogExit();
             return;
         }
     }
     if (this.Types == null || this.Types.Count == 0)
     {
         this.types = new MultiValuedProperty <SecurityPrincipalType>();
         this.types.Add(SecurityPrincipalType.WellknownSecurityPrincipal);
         this.types.Add(SecurityPrincipalType.User);
         this.types.Add(SecurityPrincipalType.Computer);
         this.types.Add(SecurityPrincipalType.Group);
     }
     else
     {
         this.types = this.Types;
     }
     if (this.Identity != null)
     {
         this.Identity.IncludeDomainLocalFrom = this.includeDomainLocalFrom;
         this.Identity.Types = this.types;
     }
     base.InternalProcessRecord();
     TaskLogger.LogExit();
 }
        // Token: 0x06001084 RID: 4228 RVA: 0x000602E8 File Offset: 0x0005E4E8
        internal static IList <string> GetDomains()
        {
            List <string>     domains           = new List <string>();
            ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
            {
                ADForest localForest          = ADForest.GetLocalForest();
                ADCrossRef[] domainPartitions = localForest.GetDomainPartitions();
                foreach (ADCrossRef adcrossRef in domainPartitions)
                {
                    domains.Add(adcrossRef.NCName.DistinguishedName);
                }
            }, 3);

            if (!adoperationResult.Succeeded)
            {
                GroupMetricsGenerator.EventLogger.LogEvent(InfoWorkerEventLogConstants.Tuple_UnableToGetDomainList, null, new object[]
                {
                    adoperationResult.Exception.GetType().FullName,
                    adoperationResult.Exception.Message
                });
            }
            return(domains);
        }
Пример #5
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();
        }
        private static Fqdn[] GetDomainControllersInLocalSite(Task.TaskErrorLoggingDelegate errorLogger)
        {
            ADForest localForest = ADForest.GetLocalForest();

            if (localForest == null)
            {
                errorLogger(new TaskException(Strings.ErrorCannotRetrieveLocalForest), (ErrorCategory)1001, null);
            }
            List <ADServer> list = localForest.FindAllGlobalCatalogsInLocalSite();

            if (list == null || list.Count == 0)
            {
                errorLogger(new TaskException(Strings.ErrorNoDCInLocalSite), (ErrorCategory)1001, null);
            }
            Fqdn[] array = new Fqdn[list.Count];
            int    num   = 0;

            foreach (ADServer adserver in list)
            {
                array[num] = new Fqdn(adserver.DnsHostName);
                num++;
            }
            return(array);
        }
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            ADForest localForest = ADForest.GetLocalForest();

            this.rootDomain      = localForest.FindRootDomain();
            this.topLevelDomains = localForest.FindTopLevelDomains();
            List <string> list = new List <string>();
            ReadOnlyCollection <ADDomain> readOnlyCollection = localForest.FindDomains();

            foreach (ADDomain addomain in readOnlyCollection)
            {
                if (!list.Contains(addomain.Fqdn))
                {
                    list.Add(addomain.Fqdn);
                }
            }
            IConfigurationSession configurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 85, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\ExchangeServer\\GetUserPrincipalNamesSuffix.cs");

            configurationSession.UseGlobalCatalog    = true;
            configurationSession.EnforceDefaultScope = false;
            ADCrossRefContainer[] array = configurationSession.Find <ADCrossRefContainer>(null, QueryScope.SubTree, null, null, 0);
            if (array != null && array.Length > 0)
            {
                foreach (string item in array[0].UPNSuffixes)
                {
                    if (!list.Contains(item))
                    {
                        list.Add(item);
                    }
                }
            }
            IConfigurationSession configurationSession2 = (IConfigurationSession)this.CreateSession();

            if (this.OrganizationalUnit != null)
            {
                ExtendedOrganizationalUnit extendedOrganizationalUnit = null;
                IEnumerable <ExtendedOrganizationalUnit> objects      = this.OrganizationalUnit.GetObjects <ExtendedOrganizationalUnit>(null, configurationSession2);
                using (IEnumerator <ExtendedOrganizationalUnit> enumerator3 = objects.GetEnumerator())
                {
                    if (enumerator3.MoveNext())
                    {
                        extendedOrganizationalUnit = enumerator3.Current;
                        if (enumerator3.MoveNext())
                        {
                            base.WriteError(new ManagementObjectAmbiguousException(Strings.SpecifiedOUNotUnique), ErrorCategory.InvalidArgument, extendedOrganizationalUnit);
                        }
                    }
                    else
                    {
                        base.WriteError(new ManagementObjectNotFoundException(Strings.SpecifiedOUNotFound), ErrorCategory.InvalidArgument, extendedOrganizationalUnit);
                    }
                }
                configurationSession2.UseConfigNC      = false;
                configurationSession2.UseGlobalCatalog = false;
                extendedOrganizationalUnit             = configurationSession2.Read <ExtendedOrganizationalUnit>(extendedOrganizationalUnit.Id);
                if (extendedOrganizationalUnit != null)
                {
                    foreach (string item2 in extendedOrganizationalUnit.UPNSuffixes)
                    {
                        if (!list.Contains(item2))
                        {
                            list.Add(item2);
                        }
                    }
                }
                ADObjectId adobjectId = extendedOrganizationalUnit.Id.DomainId;
                bool       flag       = false;
                while (!flag)
                {
                    string text = adobjectId.ToCanonicalName();
                    if (this.IsTopLevelDomain(text))
                    {
                        flag = true;
                    }
                    if (!string.Equals(text, this.rootDomain.Fqdn, StringComparison.InvariantCultureIgnoreCase) && !list.Contains(text))
                    {
                        list.Add(text);
                    }
                    adobjectId = adobjectId.Parent;
                }
            }
            foreach (string sendToPipeline in list)
            {
                base.WriteObject(sendToPipeline);
            }
            TaskLogger.LogExit();
        }
Пример #8
0
        protected override void InternalValidate()
        {
            TaskLogger.LogEnter();
            base.InternalValidate();
            if (base.HasErrors)
            {
                return;
            }
            List <ADDomain> list = new List <ADDomain>();

            if (this.AllDomains && base.Fields.IsModified("Domain"))
            {
                base.WriteError(new CannotSpecifyBothAllDomainsAndDomainException(), ErrorCategory.InvalidArgument, null);
            }
            this.unreachableDomains = new List <DomainNotReachableException>();
            ADForest localForest = ADForest.GetLocalForest();

            if (this.AllDomains)
            {
                ADCrossRef[] domainPartitions = localForest.GetDomainPartitions();
                if (domainPartitions == null || domainPartitions.Length == 0)
                {
                    base.WriteError(new DomainsNotFoundException(), ErrorCategory.InvalidData, null);
                }
                foreach (ADCrossRef adcrossRef in domainPartitions)
                {
                    Exception ex = null;
                    try
                    {
                        if (this.IsDomainSetupNeeded(adcrossRef.NCName))
                        {
                            this.domainConfigurationSession.DomainController = null;
                            ADDomain addomain = this.domainConfigurationSession.Read <ADDomain>(adcrossRef.NCName);
                            base.LogReadObject(addomain);
                            list.Add(addomain);
                        }
                    }
                    catch (ADExternalException ex2)
                    {
                        ex = ex2;
                    }
                    catch (ADTransientException ex3)
                    {
                        ex = ex3;
                    }
                    if (ex != null)
                    {
                        this.unreachableDomains.Add(new DomainNotReachableException(adcrossRef.DnsRoot[0], this.TaskName, ex));
                    }
                }
                this.domainConfigurationSession.DomainController = null;
            }
            else if (base.Fields.IsModified("Domain"))
            {
                string text = (string)base.Fields["Domain"];
                if (string.IsNullOrEmpty(text))
                {
                    base.WriteError(new DomainNotFoundException("<null>"), ErrorCategory.InvalidArgument, null);
                }
                ADCrossRef adcrossRef2 = localForest.FindDomainPartitionByFqdn(text);
                if (adcrossRef2 == null)
                {
                    base.WriteError(new DomainNotFoundException(text), ErrorCategory.InvalidArgument, null);
                }
                if (this.IsDomainSetupNeeded(adcrossRef2.NCName))
                {
                    ADDomain addomain2 = localForest.FindDomainByFqdn(text);
                    addomain2 = this.domainConfigurationSession.Read <ADDomain>(addomain2.Id);
                    base.LogReadObject(addomain2);
                    list.Add(addomain2);
                }
            }
            else
            {
                ADCrossRef localDomainPartition = localForest.GetLocalDomainPartition();
                if (localDomainPartition == null)
                {
                    base.WriteError(new LocalDomainNotFoundException(), ErrorCategory.InvalidData, null);
                }
                if (this.IsDomainSetupNeeded(localDomainPartition.NCName))
                {
                    ADDomain addomain3 = localForest.FindLocalDomain();
                    addomain3 = this.domainConfigurationSession.Read <ADDomain>(addomain3.Id);
                    base.LogReadObject(addomain3);
                    list.Add(addomain3);
                }
            }
            this.domains = list.ToArray();
            TaskLogger.LogExit();
        }
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            RoleGroupCollection roleGroupCollection = InitializeExchangeUniversalGroups.RoleGroupsToCreate();
            bool flag = false;

            foreach (RoleGroupDefinition roleGroupDefinition in roleGroupCollection)
            {
                roleGroupDefinition.ADGroup = base.ResolveExchangeGroupGuid <ADGroup>(roleGroupDefinition.RoleGroupGuid);
                if (roleGroupDefinition.ADGroup == null)
                {
                    flag = true;
                }
            }
            ADGroup adgroup  = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.ExSWkGuid);
            ADGroup adgroup2 = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.E3iWkGuid);
            ADGroup adgroup3 = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.EtsWkGuid);
            ADGroup adgroup4 = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.EwpWkGuid);

            this.adSplitPermissionMode = false;
            if (this.ActiveDirectorySplitPermissions != null)
            {
                if (this.ActiveDirectorySplitPermissions.Value)
                {
                    this.adSplitPermissionMode = true;
                }
                else
                {
                    this.adSplitPermissionMode = false;
                }
            }
            else if (adgroup3 == null)
            {
                this.adSplitPermissionMode = false;
            }
            else if (adgroup4 == null)
            {
                this.adSplitPermissionMode = false;
            }
            else if (!adgroup4.Members.Contains(adgroup3.Id))
            {
                this.adSplitPermissionMode = true;
            }
            else
            {
                this.adSplitPermissionMode = false;
            }
            ADOrganizationalUnit adorganizationalUnit = this.FindExchangeUSGContainer("Microsoft Exchange Protected Groups", this.domainConfigurationSession, this.rootDomain.Id);

            if (this.adSplitPermissionMode && adorganizationalUnit == null)
            {
                adorganizationalUnit = this.CreateExchangeUSGContainer("Microsoft Exchange Protected Groups", this.domainConfigurationSession, this.rootDomain.Id);
                if (adorganizationalUnit == null)
                {
                    base.WriteError(new USGContainerNotFoundException("Microsoft Exchange Protected Groups", this.rootDomain.DistinguishedName), ErrorCategory.ObjectNotFound, null);
                }
            }
            ADOrganizationalUnit adorganizationalUnit2 = null;

            if (flag || adgroup == null || adgroup2 == null || adgroup3 == null || (!this.adSplitPermissionMode && adgroup4 == null))
            {
                adorganizationalUnit2 = this.CreateExchangeUSGContainer("Microsoft Exchange Security Groups", this.domainConfigurationSession, this.rootDomain.Id);
                if (adorganizationalUnit2 == null)
                {
                    base.WriteError(new USGContainerNotFoundException("Microsoft Exchange Security Groups", this.rootDomain.DistinguishedName), ErrorCategory.ObjectNotFound, null);
                }
            }
            else
            {
                adorganizationalUnit2 = this.FindExchangeUSGContainer("Microsoft Exchange Security Groups", this.domainConfigurationSession, this.rootDomain.Id);
            }
            this.CreateAndValidateRoleGroups(adorganizationalUnit2, roleGroupCollection);
            this.CreateGroup(adorganizationalUnit2, "Exchange Servers", 0, WellKnownGuid.ExSWkGuid, Strings.ExchangeServersUSGDescription);
            this.CreateGroup(adorganizationalUnit2, "Exchange Trusted Subsystem", 0, WellKnownGuid.EtsWkGuid, Strings.ExchangeTrustedSubsystemDescription);
            this.CreateGroup(adorganizationalUnit2, "Managed Availability Servers", 0, WellKnownGuid.MaSWkGuid, Strings.ManagedAvailabilityServersUSGDescription);
            if (this.adSplitPermissionMode)
            {
                this.CreateOrMoveEWPGroup(adgroup4, adorganizationalUnit);
            }
            else
            {
                this.CreateOrMoveEWPGroup(adgroup4, adorganizationalUnit2);
                if (adorganizationalUnit != null)
                {
                    this.domainConfigurationSession.Delete(adorganizationalUnit);
                    base.LogWriteObject(adorganizationalUnit);
                }
            }
            this.CreateGroup(adorganizationalUnit2, "ExchangeLegacyInterop", 0, WellKnownGuid.E3iWkGuid, Strings.ExchangeInteropUSGDescription);
            if (adgroup == null)
            {
                adgroup = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.ExSWkGuid);
                if (adgroup == null)
                {
                    base.WriteError(new ExSGroupNotFoundException(WellKnownGuid.ExSWkGuid), ErrorCategory.InvalidData, null);
                }
            }
            base.LogReadObject(adgroup);
            ADGroup adgroup5 = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.MaSWkGuid);

            if (adgroup5 == null)
            {
                base.WriteError(new MaSGroupNotFoundException(WellKnownGuid.MaSWkGuid), ErrorCategory.InvalidData, null);
            }
            base.LogReadObject(adgroup5);
            InitializeExchangeUniversalGroups.AddMember(adgroup, this.rootDomainRecipientSession, adgroup5, new WriteVerboseDelegate(base.WriteVerbose));
            if (adgroup2 == null)
            {
                adgroup2 = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.E3iWkGuid);
                if (adgroup2 == null)
                {
                    base.WriteError(new E2k3InteropGroupNotFoundException(WellKnownGuid.E3iWkGuid), ErrorCategory.InvalidData, null);
                }
            }
            base.LogReadObject(adgroup2);
            bool etsExisted = adgroup3 != null;

            if (adgroup3 == null)
            {
                adgroup3 = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.EtsWkGuid);
                if (adgroup3 == null)
                {
                    base.WriteError(new ExTrustedSubsystemGroupNotFoundException(WellKnownGuid.EtsWkGuid), ErrorCategory.InvalidData, null);
                }
            }
            base.LogReadObject(adgroup3);
            bool ewpExisted = adgroup4 != null;

            if (adgroup4 == null)
            {
                adgroup4 = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.EwpWkGuid);
                if (adgroup4 == null)
                {
                    base.WriteError(new ExWindowsPermissionsGroupNotFoundException(WellKnownGuid.EwpWkGuid), ErrorCategory.InvalidData, null);
                }
            }
            base.LogReadObject(adgroup4);
            this.GrantWriteMembershipPermission(adgroup3.Sid, adorganizationalUnit2);
            this.FixExchangeTrustedSubsystemGroupMembership(adgroup3, adgroup4, adgroup, roleGroupCollection.GetADGroupByGuid(WellKnownGuid.EmaWkGuid), etsExisted, ewpExisted);
            WindowsPrincipal windowsPrincipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
            string           name             = windowsPrincipal.Identity.Name;

            string[] array = name.Split(new char[]
            {
                '\\'
            }, 2);
            ADCrossRef[] domainPartitions = ADForest.GetLocalForest(base.DomainController).GetDomainPartitions();
            if (domainPartitions == null || domainPartitions.Length == 0)
            {
                base.WriteError(new DomainsNotFoundException(), ErrorCategory.InvalidData, null);
            }
            List <SecurityIdentifier> list = new List <SecurityIdentifier>();

            foreach (ADCrossRef adcrossRef in domainPartitions)
            {
                Exception ex = null;
                try
                {
                    this.domainConfigurationSession.DomainController = null;
                    ADDomain addomain = this.domainConfigurationSession.Read <ADDomain>(adcrossRef.NCName);
                    base.LogReadObject(addomain);
                    SecurityIdentifier item = new SecurityIdentifier(WellKnownSidType.AccountDomainAdminsSid, addomain.Sid);
                    list.Add(item);
                }
                catch (ADExternalException ex2)
                {
                    ex = ex2;
                }
                catch (ADTransientException ex3)
                {
                    ex = ex3;
                }
                if (ex != null)
                {
                    this.WriteWarning(Strings.DomainNotReachableWarning(adcrossRef.DnsRoot[0]));
                }
            }
            this.domainConfigurationSession.DomainController = null;
            ADGroup adgroupByGuid  = roleGroupCollection.GetADGroupByGuid(WellKnownGuid.EoaWkGuid);
            ADGroup adgroupByGuid2 = roleGroupCollection.GetADGroupByGuid(WellKnownGuid.EpaWkGuid);
            ActiveDirectoryAccessRule        activeDirectoryAccessRule = new ActiveDirectoryAccessRule(adgroupByGuid.Sid, ActiveDirectoryRights.GenericAll, AccessControlType.Allow, ActiveDirectorySecurityInheritance.All);
            List <ActiveDirectoryAccessRule> list2 = new List <ActiveDirectoryAccessRule>();

            list2.Add(activeDirectoryAccessRule);
            Guid schemaPropertyGuid = DirectoryCommon.GetSchemaPropertyGuid(this.configurationSession, "member");

            foreach (SecurityIdentifier identity in list)
            {
                list2.Add(new ActiveDirectoryAccessRule(identity, ActiveDirectoryRights.ReadProperty | ActiveDirectoryRights.WriteProperty, AccessControlType.Allow, schemaPropertyGuid, ActiveDirectorySecurityInheritance.All));
            }
            DirectoryCommon.SetAces(new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), null, adgroup, list2.ToArray());
            try
            {
                DirectoryCommon.SetAces(new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), null, adgroupByGuid, new ActiveDirectoryAccessRule[]
                {
                    activeDirectoryAccessRule
                });
            }
            catch (ADOperationException ex4)
            {
                this.WriteWarning(Strings.UnableToGrantFullControlOnEOA(adgroupByGuid.Id.ToString(), adgroupByGuid.Id.ToString(), ex4.Message));
            }
            if (adgroupByGuid2 != null)
            {
                DirectoryCommon.SetAces(new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), null, adgroupByGuid2, new ActiveDirectoryAccessRule[]
                {
                    activeDirectoryAccessRule
                });
            }
            if (adorganizationalUnit2 != null)
            {
                base.WriteVerbose(Strings.InfoSetAces(adorganizationalUnit2.Id.DistinguishedName));
                DirectoryCommon.SetAces(new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), null, adorganizationalUnit2, new ActiveDirectoryAccessRule[]
                {
                    activeDirectoryAccessRule
                });
            }
            DirectoryCommon.SetAces(new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), null, adgroup2, new ActiveDirectoryAccessRule[]
            {
                activeDirectoryAccessRule
            });
            bool useGlobalCatalog = this.recipientSession.UseGlobalCatalog;

            this.recipientSession.UseGlobalCatalog = true;
            try
            {
                ADRecipient adrecipient = (ADRecipient)this.recipientSession.FindByAccountName <ADRecipient>(array[0], array[1]);
                if (adrecipient != null)
                {
                    TaskLogger.Trace("Adding user {0} ({1}), to group {2}.", new object[]
                    {
                        name,
                        adrecipient.DistinguishedName,
                        adgroupByGuid.DistinguishedName
                    });
                    InitializeExchangeUniversalGroups.AddMember(adrecipient, this.rootDomainRecipientSession, adgroupByGuid, new WriteVerboseDelegate(base.WriteVerbose));
                }
                else
                {
                    TaskLogger.Trace("Didn't find user {0})", new object[]
                    {
                        name
                    });
                }
            }
            catch (ADOperationException ex5)
            {
                base.WriteVerbose(new LocalizedString(ex5.Message));
            }
            this.recipientSession.UseGlobalCatalog = useGlobalCatalog;
            TaskLogger.LogExit();
        }