Santosh Benjamin's Weblog

Adventures with AppFabric, BizTalk & Clouds

Powershell : Calling BTSTask.exe

with one comment


I set out to write a bunch of PS functions to manage Biztalk to keep in a little script library that i could then call from external scripts etc (I found and came up with some other good stuff that i’ll share shortly but this is something i had to write about immediately).

One of the tasks was to export bindings for an application. This is something that i found incredibly hard to do from within a function. It works alright when just called interactively, just like any normal command prompt, but invoking the process within a function had me lose a lot of hair (and theres very little spare anyway 😦 ).

Anyhow, i’ll spare you the gory details. After mucking around with System.Process, trying to capture the output window , invoking cmd etc, the solution was drop dead simple.

A snippet of the function is as follows

function bts-application-exportbindings ([string]$bindingFile, [string]$appName)

{

$taskParams = ” ExportBindings /Destination:$bindingfile /ApplicationName:$appName ”

$p = [diagnostics.process]::start(“BTSTask.exe”, $taskParams)

}

Thats all. But my goodness, it had me really frustrated for a while. C’est la vie!! Hope it helps some of you…

Advertisements

Written by santoshbenjamin

September 30, 2008 at 7:20 PM

Posted in BizTalk, Powershell

Tagged with ,

One Response

Subscribe to comments with RSS.

  1. Thanks a bunch. You saved my time.

    abc

    January 10, 2012 at 9:15 AM


Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: