0

I use EXECUTE xp_cmdshell in a SQL Stored Procedure to call a batch file. All commands in the batch file get executed except for one.

The Reporting Services command rs.exe does not execute.

There is a proxy account for xp_cmdshell and the command runs just fine from my stored procedure:

select @message = 
'\\servername\LabelPrinting\ReportPrinting\Parts\PostSubmitAdjustment.bat '+ cast(@TrxOid as nvarchar(100))

EXECUTE xp_cmdshell @message

The above works.

The problem is with the batch file it calls, which is included at the bottom of this question.

All of the commands in the .bat file are executed except the rs.exe.

But when I call the same batch file from the SQL server, using the proxy account, all commands in the batch execute properly, including the rs.exe

Batch file:

@rem - Capture the call to this file for diagnostics and logging. 
echo %1 > \\servername\LabelPrinting\ReportPrinting\logs\DataPassLogAdjust.txt 


@rem - Calls the rs.exe utility, passing in the TrxOid to generate the Packing slip as a PDF then save the PDF as the TrxOid in the PackingSlip folder.

call \\servername\LabelPrinting\ReportPrinting\Parts\rs.exe -i \\servername\LabelPrinting\ReportPrinting\Parts\PackingSlipAdjustment.rss -s http://WEBSITE-02/reportserver -v Oid=%1 -v PDFName=\\servername\LabelPrinting\ReportPrinting\PackingSlips\%1_PackingSlip.PDF -e Exec2005 > \\servername\LabelPrinting\ReportPrinting\logs\RenderLogAdjust.txt 


call whoami > \\servername\LabelPrinting\ReportPrinting\logs\UserLogAdjust.txt


@rem - Calls the Command Line Printing application to print the PackingSlip pdf to the printer defined in the ReportPrinter setting on the PanatrackerGP portal

call \\servername\LabelPrinting\ReportPrinting\Parts\clprint.exe /print /printer:P01 /pdffile:"\\servername\LabelPrinting\ReportPrinting\PackingSlips\%1_PackingSlip.PDF" > \\servername\LabelPrinting\ReportPrinting\logs\PrintLogAdjust.txt
Karl
  • 13
  • 5

0 Answers0