Exemplo n.º 1
0
        public static List <string> GetServersWithServerRoleInSite(string serverName, ServerRole serverRole)
        {
            IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true);
            IADServer iadserver = null;

            if (!string.IsNullOrEmpty(serverName))
            {
                if (!SharedHelper.StringIEquals(serverName, "localhost"))
                {
                    goto IL_2F;
                }
            }
            try
            {
                iadserver = iadtoplogyConfigurationSession.FindServerByName(Environment.MachineName);
                goto IL_5A;
            }
            catch (LocalServerNotFoundException)
            {
                goto IL_5A;
            }
IL_2F:
            string nodeNameFromFqdn = MachineName.GetNodeNameFromFqdn(serverName);

            iadserver = iadtoplogyConfigurationSession.FindServerByName(nodeNameFromFqdn);
            string arg = "FindServerByName";

            if (iadserver == null)
            {
                ExTraceGlobals.ReplayConfigurationTracer.TraceDebug <string, string>(0L, "GetServersWithServerRoleInSite: {0} didn't find any server for {1}", arg, serverName);
            }
IL_5A:
            return(ReplayConfiguration.GetServersWithServerRoleInSiteByServer(iadserver, serverRole));
        }