public void Execute()
        {
            logger.Info("Extract Users List in progress...");
            var         projectCollections = CatalogNodeBrowsingHelper.GetProjectCollections(configurationServer.CatalogNode);
            List <User> userList           = IdentityServiceManagementHelper.GetAllIdentities(configurationServer, projectCollections).ToList();

            // Now get the "ou" attribute from the Active Directory (so as to gets a user's Service)
            if (this.extractOUOption)
            {
                logger.Info("Fetch the ou property in the AD");
                Fetch_OU_ADProperty(userList);
            }

            string fileName = FileNameTool.GetFileName("TfsExtractUsersList");

            using (CsvWriter csv = new CsvWriter(new StreamWriter(fileName)))
            {
                csv.Configuration.RegisterClassMap <ProjectDefinitionCsvMap>();
                csv.WriteExcelSeparator();

                if (this.extractOUOption)
                {
                    csv.WriteRecords(userList.Where(x => !string.IsNullOrEmpty(x.OU) && !x.OU.StartsWith(Environment.GetEnvironmentVariable("LDAP_OU_FILTER_OUT"))).DistinctBy(x => x.OU).OrderBy(x => x.Name));
                }
                else
                {
                    csv.WriteRecords(userList.DistinctBy(x => x.Mail).OrderBy(x => x.Name));
                }
            }

            logger.Info("Extract Users done");
        }
        public void Execute()
        {
            logger.Info("Extract Project List in progress...");
            ICollection <ProjectDefinition> projectList = TeamProjectHelper.GetAllProjects(configurationServer);

            string fileName = FileNameTool.GetFileName("TfsExtractProjectList");

            using (CsvWriter csv = new CsvWriter(new StreamWriter(fileName)))
            {
                csv.Configuration.RegisterClassMap <ProjectDefinitionCsvMap>();
                csv.WriteExcelSeparator();
                csv.WriteRecords(projectList);
            }

            logger.Info("Extract Project done");
        }
        public void Execute()
        {
            logger.Info("Extract Build Machines in progress...");
            ICollection <BuildServiceHostDefinition> buildServiceHostList = BuildServerHelper.GetAllBuildServiceHosts(configurationServer);

            ArrayList records = new ArrayList();

            foreach (BuildServiceHostDefinition buildServiceHostDefinition in buildServiceHostList)
            {
                foreach (BuildControllerDefinition controller in buildServiceHostDefinition.BuildControllers)
                {
                    records.Add(
                        new {
                        HostName       = buildServiceHostDefinition.Name,
                        IP             = GetIPFromHostName(buildServiceHostDefinition.Name),
                        CollectionName = buildServiceHostDefinition.CollectionName,
                        ServiceType    = "Controller",
                        ServiceName    = controller.Name,
                        Status         = controller.Status
                    });
                }
                foreach (BuildAgentDefinition agent in buildServiceHostDefinition.BuildAgents)
                {
                    records.Add(
                        new
                    {
                        HostName       = buildServiceHostDefinition.Name,
                        IP             = GetIPFromHostName(buildServiceHostDefinition.Name),
                        CollectionName = buildServiceHostDefinition.CollectionName,
                        ServiceType    = "Agent",
                        ServiceName    = agent.Name,
                        Status         = agent.Status
                    });
                }
            }

            string fileName = FileNameTool.GetFileName("TfsExtractMachineList");

            using (CsvWriter csv = new CsvWriter((new StreamWriter(fileName))))
            {
                csv.WriteExcelSeparator();
                csv.WriteRecords(records);
            }

            logger.Info("Extract Build Machines done");
        }