public override bool Execute() { #if DEBUG Thread.Sleep(10000); #endif if (!(AppServers == null || AppServers.Any()) && ((ServiceName != null && ServiceName.Any()) || (ComputerName != null && ComputerName.Any()))) { throw new ArgumentException("You must specify either the AppServers parameter or both the ServiceName and ComputerName parameters"); } if (AppServers != null && AppServers.Any()) { var appServers = MsBuild.DeserializeServers <AppServer>(AppServers); var computerServices = appServers.Select(s => new { s.ServiceName, s.HostName }) .Distinct() .GroupBy(s => s.HostName) .ToDictionary(c => c.Key, c => c.Select(s => s.ServiceName).ToArray()); var returnValue = 0; computerServices.AsParallel().ForAll(computerService => { returnValue += Run(computerService.Value, new [] { computerService.Key }); }); return(returnValue == 0); } return(Run(ServiceName, ComputerName) == 0); }