If you're developing custom reports, you need to know the name of the Analysis Services server for Team System so that you can connect to the Team System cube. Typically, AS is deployed on the data tier server. However, it can be moved to another server to get the load off the data-tier server. In fact, that's a really good practice. If you need to find the Analysis Services server, use the following code. You'll need to reference Microsoft.TeamFoundation.dll and Microsoft.TeamFoundation.Client.dll. Unfortunately, this code will only work if you have TFS administration rights.

Allen

        /// <summary>

        /// Returns the AS server name for the specified TFS instance.

        /// </summary>

        /// <param name="teamFoundationServerUrl">Team Foundation Server URL (i.e. http://server1:8080).</param>

        /// <returns>AS Server Name.</returns>

        public static string GetASServerName(string teamFoundationServerUrl)

        {

            if (String.IsNullOrEmpty(teamFoundationServerUrl))

            {

                throw new ArgumentException("Argument cannot be null or empty.", "teamFoundationServerUrl");

            }

 

            string toolId = "vstfs";

            TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(teamFoundationServerUrl);

            IRegistration iRegistration = (IRegistration)tfs.GetService(typeof(IRegistration));

            RegistrationEntry[] registrationEntries = iRegistration.GetRegistrationEntries(toolId);

 

            if (registrationEntries.Length < 1)

            {

                throw new Exception(string.Format("Registration does not have an entry for tool Id \"{0}\"", toolId));

            }

            if (registrationEntries.Length > 1)

            {

                throw new Exception(string.Format("Registration has more than one entry for tool Id \"{0}\"", toolId));

            }

 

            Database[] databases = registrationEntries[0].Databases;

            Database database = null;

            for (int i = 0; i < databases.Length; i++)

            {

                if (string.Compare("BISANALYSIS DB", databases[i].Name, StringComparison.OrdinalIgnoreCase) == 0)

                {

                    database = databases[i];

                    break;

                }

            }

 

            if (database == null)

            {

                throw new Exception(string.Format("Registration for tool Id \"{0}\" does not have a database entry with name \"BISANALYSIS DB\" ", toolId));

            }

 

            return database.SQLServerName;

        }