Execute Process Task - The process exit code was "2" while the expected was "0"

  • gdebbe

    SSC Veteran

    Points: 279

    I have an SSIS that includes an Execute Process Task. The task has the executable, arguments, and working directory properties populated by myself and all other propeties are defaulted. The SSIS package and task run successfully when I manually run them from Visual Studio. I also have imported the SSIS Package Into Integrations Services and can successfully run the package if I execute it manually. When I run the SSIS package from a job, the job completes successfully, but the Execute Process Task does not run. I get the following text included in the message form the job history as it relates to the Execute Process Task:

    The process exit code was "2" while the expected was "0". End Error DTExec: The package execution returned DTSER_SUCCESS (0). Started: 1:58:37 PM Finished: 1:59:17 PM Elapsed: 40.594 seconds. The package executed successfully. The step succeeded.

    I believe this is related to Proxies, Credentials, Server Logins and/or Local user security. Can anyone help?

  • BSql_Dev

    Right there with Babe

    Points: 765

    Hi,

    I had the problem Exit code not 0 in Execute process task. I first checked on command prompt that its working from command prompt.

    Then I just changed the path from network style "\\sql-srv\myprojekt\proj.exe" to normal file style "D:\project\proj.exe" and it starts working.

    Its strange but it worked for me 🙂

    Regards

  • Hesten Erwin

    Mr or Mrs. 500

    Points: 569

    I am also getting a similar error!

    My Execute Process Task is supposed to run a batch file, which in turn is supposed to Process a Cognos cube.

    The batch file contains "path to .exe" -n "Output path"

    When I run the package manually, through BIDS, it is fine. The success value is set to 0.

    When I run it using a SQL Server Agent Job, it fails. It reports the following error: In Executing "Path to batch file" ""at"", The process exit code was "1" while the expected was "0".

    If I change the SuccessValue to 1, the Manual execution of the task/package fails. When running it using a SQL Server Agent Job, the job doesn't report an error anymore, but the cube does not update.

    What am I supposed to do?

    Why are these errors occurring?

    Is there any way to get better or more descriptive error messages?

    Please advise!

    Sorry for joining in on your post, hopefully we can both get answers for our errors!!!

  • BSql_Dev

    Right there with Babe

    Points: 765

    I dont know exactly I am new to SSIS and trying to learn.;-)

    But it can be problem of credentials but in my case as i said before that I just changed the path and it started working.

  • Manko T

    SSC Enthusiast

    Points: 147

    I'm wondering if you ever figured out what the problem was. Interestingly enough, I'm also encountering the same problem trying to run a batch file with WinSCP. I can run the package without any issue manually (by right-clicking and run package from SQL Server), but as soon as I tried to schedule it on the Sql Server Agent Jobs, it gives me that same error msg.

    Description: In Executing "C:\Scripts\hrxfer.bat" "" at "", The process exit code was "1" while the expected was "0". End Error DTExec: The package execution returned DTSER_SUCCESS (0). Started: 2:55:00 PM Finished: 2:55:02 PM Elapsed: 1.516 seconds. The package executed successfully. The step succeeded.

    Any help is appreciated.

    Hesten Erwin (3/31/2009)


    I am also getting a similar error!

    My Execute Process Task is supposed to run a batch file, which in turn is supposed to Process a Cognos cube.

    The batch file contains "path to .exe" -n "Output path"

    When I run the package manually, through BIDS, it is fine. The success value is set to 0.

    When I run it using a SQL Server Agent Job, it fails. It reports the following error: In Executing "Path to batch file" ""at"", The process exit code was "1" while the expected was "0".

    If I change the SuccessValue to 1, the Manual execution of the task/package fails. When running it using a SQL Server Agent Job, the job doesn't report an error anymore, but the cube does not update.

    What am I supposed to do?

    Why are these errors occurring?

    Is there any way to get better or more descriptive error messages?

    Please advise!

    Sorry for joining in on your post, hopefully we can both get answers for our errors!!!

  • olu-699940

    SSC Enthusiast

    Points: 176

    We have a Process Task component setup in a couple SSIS jobs to call a GNU (gpg.exe) for decryption. The process works fine if we start the SQL Agent job (both manually or schedule) under the proxy setup account only when we leave a login session open on the server (login is the proxy account).

    The process fails if there are no login session open on the server.

    The exact error has to do with the gpg.exe unable to find a particular security file.

    It appears the issue is associated with a need to find the security key file in the %PATH% . Is the path specified in the system enviroment available to SSIS? if not how can one specify the path? Thanks.

  • AmolNaik

    SSCarpal Tunnel

    Points: 4767

    Manko T,

    It's probably related to the permission issues on the file directory, since the Jobs runs under the credentials of SQL Server agent, check to see if that credentials has the access to the file location.

    Hope this helps.

    Cheers,

    Amol

    Amol Naik

  • olu-699940

    SSC Enthusiast

    Points: 176

    Thanks for your input. The user context under which the SSIS job runs has access to the server ( system admin rights)

    I actually tried different combinations of scenarios and came to the following conclusion - that might just have to do with the GnuPG application specifically - or may be a limitation of windows/SSIS.

    1. The job when run by sqlAgent was unable to determine any enviroment variables and registry settings, unless the server have an existing login session of the user credentials the job runs as. the job runs under a user credential that has sys admin rights.

    2. The failure of the Job was because the GnuPG application was unable to access certain files stored in the %APPDATA%\gnupg of the user credentials under which the SSIS job runs,.

    3. The GnuPG application provide an option to specify the homeDir as one of the arguments the executeable (C-style args). this was then used to overcome the limitation experienced in 2 above.

    I hope this will be helpful to others experiencing similar issues

    rgds

    Olu

  • SQL Juice Man

    SSC Journeyman

    Points: 89

    I experienced the same problem with SSIS and GnuPG for Windows (OpenSource PGP encryption tool), where the SSIS package would run locally but would not run when executed as a job by the SQL Server Agent. Two things solved my problem:

    1. Because GnuPG for Windows stores encryption keys locally to the account that creates the keys, you need to login and create the GnuPG keys with the account that the SQL Server Agent will use when it executes the package.

    2. In the SSIS “Execute Process Task”, I had to use a local path to the gpg.exe file vs. a UNC path.

    Example, I used: "C:\Program Files\GNU\GnuPG\gpg.exe"

    instead of...

    "\\[server name]\C$\Program Files\GNU\GnuPG\gpg.exe”

    Hope this helps!

  • athmaram_p

    SSC Enthusiast

    Points: 105

    Hi Everyone

    I am also having some issues with automating the PGP Decryption using SSIS package.

    Here are steps I am doing:

    1) Used Execute Process Task Editor

    2) Passed the GNU executable as an Executable value to Execute Process Task

    3) Entered the following text in the Arguments

    --passpharse-fd 0 --output \\<OutputFile Location>\test.101019.txt --decrypt \\<EncryptedFile Location>\test.101019.txt.gpg

    4) Set the Success Value to 2

    When I execute the task, it is running successfully but I unable to find OUTPUT file in the specified location.

    Please help me in resolving this issue.

    Thanks

    Ram

  • Alvin_D

    Valued Member

    Points: 65

    So that this helps someone.

    The reply is correct that it has to do with credentials when running the package via DTExec.exe. GNU cannot run under SQL agent untill the following was done. All I had to do was to add the pubring and secring files used to decrypt the files in C:\Documents and Settings\SQLSERVICE\Application Data\gnupg folder. "SQLSERVICE" could be different on your system. Then the Job runs, otherwise I would get the process ended with exit code 2 when 0 was expected.

    Hope this helps someone

  • keniaa

    SSC Enthusiast

    Points: 100

    Same issue here. Did you ever find a solution?

    thanks,

    Kenia

  • suresh t

    Valued Member

    Points: 63

    Hi Ram,

    Struck with the same step where u were, please post any update if u get.

    Thanks,

    Suresh

  • HBhagat

    Hall of Fame

    Points: 3278

    Hi,

    I also ran into the same problem.

    I was unzipping the folders to a different location. The folders were unzipped successfully, but it used to fail always with the error with the exit code.

    I made the changes in the expression task for the column "FailTaskReturnCodeIsNotSuccessValue" to False.:-)

    This worked for me.

    Hope this helps.

  • latingntlman

    SSCarpal Tunnel

    Points: 4348

    Hello all,

    I'm having a similar issue but the exit code is "12" while the expected was "0". I'm completely stuck and not sure what it means or where it's coming from. Basically it's a container. Inside of it there's and Execute Process Task Editor, which executes a batch file, which has code that pulls data from TERADATA, then exports it to a text file. After this, a Data Flow Task imports the data from the text file into a SQL table.

    The container errors out about 3 seconds after the executable batch has fired off. I looked it up on the web but nothing with "exit code 12.

    Has anyone experienced this situation before, if so, what can be done?

    Regards,

    J.

Viewing 15 posts - 1 through 15 (of 22 total)

You must be logged in to reply to this topic. Login to reply