PsExec v1.98 does not show build output in Team City 7.1

I am trying to use Team City to install a Windows 2008 R2 machine using a window puppet. There is a TC agent that needs to remotely connect and invoke a puppet client inside our target server. We tried using Powershell, but we had problems trying to execute the puppet as administrator, so we created a C # code utility to redirect the output, but it doesn't seem to work on TC, but works locally.

namespace RunAsAdmin
{
    class Program
    {
        static void Main(string[] args)
        {
            Process proc = new Process();

            Process p = new Process();
            p.StartInfo.FileName = @"psexec.exe";
            p.StartInfo.Arguments = "/accepteula \\\\" + args[0] + " -s \"C:\\Program Files (x86)\\Puppet Labs\\Puppet\\bin\\puppet.bat\" agent --test --no-daemonize --verbose --logdest console ";
            p.StartInfo.Verb = "runas";
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

            p.Start();

            while (p.HasExited == false) {
               Console.WriteLine(p.StandardOutput.ReadLine());
            }
            Console.ReadLine();
            p.WaitForExit();
            p.Close();


        }
    }
}

      

The code works fine locally and with TC and has no execution issues as administrator, but we can't see the build output in TC.

+3


source to share





All Articles