• I would not be attempting to execute an external program from within a transaction - there are many potential problems including security (which I suspect may be your current problem) and, potentially, performance.

    Personally, I would log sufficient information for the file to be written asyncronously and use completely separate process (that read the log) to actually write the files. There are many options for implementing this including SSIS and also OSQL perhaps scheduled for execution using SQL Server Agent. Another option is to implement the writing of the files using Service Broker.