Click here to Skip to main content
15,898,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
String command = "installutil/i";
		    string wanted_actual = "D:\\pstools\\";
                    string wanted = wanted_actual + "PsExec";               

                    String folderpath2 = D:\Winservice\Service.exe
                    String total = (command + " " + folderpath2);

                    System.Diagnostics.Process proc = new System.Diagnostics.Process();
                    ProcessStartInfo procStartInfo = new ProcessStartInfo();
                    procStartInfo.FileName = wanted;    
                    procStartInfo.WorkingDirectory = Path.GetDirectoryName(wanted_actual);                                  
                    procStartInfo.Arguments = @"\\" + txt_Serverip.Text + " -u " + txt_Username.Text + " -p " + txtPassword.Text + " -accepteula" + " -s" + " -w " + "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319" + " cmd " + "/c " + total;
                    proc.StartInfo = procStartInfo;
                    proc.StartInfo.RedirectStandardOutput = true;
                    procStartInfo.UseShellExecute = false; //To hide window
                    procStartInfo.CreateNoWindow = true; //To hide window
                    procStartInfo.WindowStyle = ProcessWindowStyle.Hidden; //To hide window                   
                    proc.Start();

                    richTextBox1.Text = proc.StandardOutput.ReadToEnd();


What I have tried:

I want to Capture installed log from server to Local . Using
proc.StandardOutput.ReadToEnd(); i am able to capture only first 2 lines of log from server
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
But the same command i execute from cmd able to view the entire winservice installed log in cmd prompt. but while install using C# unable to view the log in richTextBox1.Text

Please help me ...
Posted
Updated 13-Feb-16 23:13pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900