Kirankumar P

Kirankumar P

  • NA
  • 3
  • 822

I want to Capture installed log from server to Local ,C#

Feb 20 2016 1:58 AM
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 ...
 
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;
procStartInfo.CreateNoWindow = true; 
procStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.Start(); 
richTextBox1.Text = proc.StandardOutput.ReadToEnd();
 

Answers (2)