private static ADComputer GetComputerObject(string name, ITopologyConfigurationSession gcSession, ManageSendConnectors.ThrowTerminatingErrorDelegate throwDelegate) { TaskLogger.LogEnter(); ADComputer adcomputer = gcSession.FindComputerByHostName(name); if (adcomputer == null) { throwDelegate(new SendConnectorComputerNotFoundException(name), ErrorCategory.ObjectNotFound, null); } TaskLogger.LogExit(); return adcomputer; }
public static void UpdateGwartLastModified(ITopologyConfigurationSession configSession, ADObjectId sourceRoutingGroup, ManageSendConnectors.ThrowTerminatingErrorDelegate throwDelegate) { TaskLogger.LogEnter(); if (ManageSendConnectors.IsE12RoutingGroup(sourceRoutingGroup)) { configSession.UpdateGwartLastModified(); TaskLogger.Trace("Updated E12 Legacy GWART {0}", new object[] { LegacyGwart.DefaultName }); } TaskLogger.LogExit(); }
public static void RemoveServersFromGroup(IList<ADObjectId> serverIds, ADGroup group, IRecipientSession recipSession, ITopologyConfigurationSession gcSession, ManageSendConnectors.ThrowTerminatingErrorDelegate throwDelegate) { TaskLogger.LogEnter(); if (serverIds.Count == 0) { TaskLogger.LogExit(); return; } foreach (ADObjectId adobjectId in serverIds) { ADComputer computerObject = ManageSendConnectors.GetComputerObject(adobjectId.Name, gcSession, throwDelegate); if (group.Members.Contains(computerObject.Id)) { TaskLogger.Trace("Removing server '{0}' from group '{1}'", new object[] { adobjectId.Name, group.Name }); group.Members.Remove(computerObject.Id); } } recipSession.Save(group); TaskLogger.LogExit(); }
public static ADGroup GetWellKnownGroup(Guid groupGuid, IConfigurationSession configSession, ManageSendConnectors.ThrowTerminatingErrorDelegate throwDelegate, out IRecipientSession recipSession, out ITopologyConfigurationSession gcSession) { TaskLogger.LogEnter(); ADGroup adgroup = null; recipSession = null; recipSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 530, "GetWellKnownGroup", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\Transport\\ManageSendConnectors.cs"); try { recipSession.UseGlobalCatalog = true; adgroup = recipSession.ResolveWellKnownGuid<ADGroup>(groupGuid, configSession.ConfigurationNamingContext); recipSession.UseGlobalCatalog = false; adgroup = (ADGroup)recipSession.Read(adgroup.Id); } finally { recipSession.UseGlobalCatalog = false; } if (adgroup == null) { try { ADDomain addomain = ADForest.GetLocalForest().FindRootDomain(true); if (addomain != null) { recipSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(addomain.OriginatingServer, false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 564, "GetWellKnownGroup", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\Transport\\ManageSendConnectors.cs"); adgroup = recipSession.ResolveWellKnownGuid<ADGroup>(groupGuid, configSession.ConfigurationNamingContext); } } catch (ADReferralException) { } } if (adgroup == null) { throwDelegate(new ErrorExchangeGroupNotFoundException(groupGuid), ErrorCategory.ObjectNotFound, null); } gcSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 589, "GetWellKnownGroup", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\Transport\\ManageSendConnectors.cs"); gcSession.UseConfigNC = false; gcSession.UseGlobalCatalog = true; TaskLogger.LogExit(); return adgroup; }
public static void RemoveServersFromGroup(IList<ADObjectId> serverIds, Guid groupGuid, ITopologyConfigurationSession configSession, ManageSendConnectors.ThrowTerminatingErrorDelegate throwDelegate) { TaskLogger.LogEnter(); IRecipientSession recipSession; ITopologyConfigurationSession gcSession; ADGroup wellKnownGroup = ManageSendConnectors.GetWellKnownGroup(groupGuid, configSession, throwDelegate, out recipSession, out gcSession); ManageSendConnectors.RemoveServersFromGroup(serverIds, wellKnownGroup, recipSession, gcSession, throwDelegate); TaskLogger.LogExit(); }