nkurothe -> RE: MISSING: MSExchangeTransport Log Search Service (9.Sep.2008 10:57:33 AM)
I am facing the same problem but the only difference is i get this error when i try to execute the command through code, if i run it through powershell it works fine
here is more info on it
i have a powershell script which is some thing like this
get-messagetrackinglog -messagesubject test | export-csv 'D:\Documents and Settings\Administrator\Desktop\exchange2007\Book1.csv'
well if i run this thru command prompt it runs nice n clear but when i try to run this thru code i get the following error
Get-MessageTrackingLog : Failed to connect to the Microsoft Exchange Transport Log Search service on computer "mycompany.mycompanyv2.com". Verify that a valid computer name was used and the Microsoft Exchange Transport Log Search service is started on the target computer. The error message is: Access is denied.At D:\Documents and Settings\Administrator\Desktop\exchange2007\test.ps1:2 char:23+ get-messagetrackinglog <<<< -messagesubject test | export-csv 'D:\Documents and Settings\Administrator\Desktop\exchange2007\Book1.csv'
here is code snippet as well, i have provided impersonation so that the code can execute with admin rights
string command = "powershell.exe \"& 'D:\\Documents and Settings\\Administrator\\Desktop\\exchange2007\\test.ps1'\"";
System.Diagnostics.ProcessStartInfo procStartInfo =
new System.Diagnostics.ProcessStartInfo("cmd","/c "+command);
// The following commands are needed to redirect the standard output.
// This means that it will be redirected to the Process.StandardOutput StreamReader.
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
// Do not create the black window.
procStartInfo.CreateNoWindow = true;
// Now we create a process, assign its ProcessStartInfo and start it
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
test = Environment.UserName + " - " + this.User.Identity.Name;
catch (Exception ex)
// Get the output into a string
result += proc.StandardOutput.ReadLine();