Invoke Btstask from .net code

private static void InvokeBtsTask(string taskParams)
System.Diagnostics.Debug.WriteLine(string.Format(” Begin BTSTask with params {0}”, taskParams));
StringBuilder taskOutput = new StringBuilder();
Process btsTask = new Process
StartInfo =
FileName = “BTSTask.exe”,
Arguments = taskParams,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
CreateNoWindow = true

while (btsTask.StandardOutput.Peek() > -1)

System.Diagnostics.Debug.WriteLine(string.Format(“BTSTask exited with message {0}”, taskOutput.ToString()));

System.Diagnostics.Debug.WriteLine(string.Format(” End BTSTask with params {0}”, taskParams));

if(!taskOutput.ToString().Contains(“Command succeeded with 0 errors, 0 warnings”))
throw new ApplicationException(String.Format(“Error while executing BTSTask.exe with parameters {0} error message {1}”,taskParams,taskOutput.ToString()));


One thought on “Invoke Btstask from .net code”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: