SQL Server Job Can't Execute a Batch File
I have a batch file that I am trying to execute via a SQL Server Job. The contents of the batch file are as follows (I am using 7zip): echo c: cd c:\Program Files (x86)\7-zip 7z e R:\CasambaRefresh\DWExport_ProcessQueue\SmartExport*.zip -oR:\CasambaRefresh\DWExport_ProcessQueue -r cd\ echo off I have the call to the batch file in an Execute Process Task (window hidden) of an SSIS 2008 package . If I run the packge from the file system, the batch file executes. If I run the batch file from the command line, no problems there either. If I run the package through a SQL Server Job, the Job hangs. I created a Job just for the batch file, and set its 'Type' as an Operating System Command. The Job runs with success, but the zip files are not extracted. The Job is being run under the SQL Server Agent Service Account. I don't know what rights may be a problem for this account, or whether the account is the problem. Is there some way I can alter the contents of the batch file? Thank you for your help. cdun2
February 11th, 2011 11:17pm

The commands will be running under the context of the SQL Server Agent service account unless you set up a proxy account for it to run under. My guess is that the SQL Server Agent account does not know what the R drive is, look at using a proxy account that does or create a network share and assign the neccessary permisions to the agent account. The reason the job is being reported as successful is that the bat file was successfully called it will not report an error if the bat file errors.If you find this helpful, please mark the post as helpful, If you think this solves the problem, please propose or mark it an an answer. Please provide details on your SQL Server environment such as version and edition, also DDL statements for tables when posting T-SQL issues Richard Douglas My Blog: Http://SQL.RichardDouglas.co.uk Twitter: @SQLRich
Free Windows Admin Tool Kit Click here and download it now
February 12th, 2011 1:47am

The commands will be running under the context of the SQL Server Agent service account unless you set up a proxy account for it to run under. My guess is that the SQL Server Agent account does not know what the R drive is, look at using a proxy account that does or create a network share and assign the neccessary permisions to the agent account. The reason the job is being reported as successful is that the bat file was successfully called it will not report an error if the bat file errors. If you find this helpful, please mark the post as helpful, If you think this solves the problem, please propose or mark it an an answer. Please provide details on your SQL Server environment such as version and edition, also DDL statements for tables when posting T-SQL issues Richard Douglas My Blog: Http://SQL.RichardDouglas.co.uk Twitter: @SQLRich I may first try a different location to unzip to. Is there a class in C# that I could leverage for unzipping files?
February 18th, 2011 11:58pm

Only in .Net 4, which you can't use in the Script Task. You can use the SharpZio library (search for that), or there are some free and commercial tasks available though at the Community Tasks and Components site. Talk to me now on
Free Windows Admin Tool Kit Click here and download it now
February 19th, 2011 12:10am

Only in .Net 4, which you can't use in the Script Task. You can use the SharpZio library (search for that), or there are some free and commercial tasks available though at the Community Tasks and Components site. Talk to me now on I wound up using DotNetZip for this. Thank you for your help! cdun2
February 19th, 2011 12:39am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics