SQL 2012 :: Calling Remote Batch File Using (Execute Process Task)
Jan 7, 2015I have a remote batch file on machine B that I need to execute using 'Execute process task' control from a package on machine A.
How Can I achieve this....
I have a remote batch file on machine B that I need to execute using 'Execute process task' control from a package on machine A.
How Can I achieve this....
I have a remote batch file on machine B that I need to execute using 'Execute process task' control from a package on machine A. The batch file uses pgp software and encrypts a file sitting on machine B itself. The reason why my batch file is sitting on machine B, is because the PGP software is on machine B.
If I execute the batch file by itself from machine B, the script runs fine. I refer the same batch file as a UNC path from my package on machine A. But that does not work since the 'Working directory' is still machine A. I can not set machine B's folder as the working dir because it does not accept UNC path. So I say, ok , let me map a path to that UNC location and map it as drive 'Z:'. Certainly if I do so, I will be running the process on machine A and the batch file will look for the pgp software on machine A, and hence fail.
I have tried third party remote batch execution tools (PSEXEC) but have not had success, not because of SSIS limitations, but simply because the PGP executable when run through the PSEXEC tool, does not identify the location of the public keys on machine B and hence gives an encrytion failure.
How do I get the remote batch file to execute such that it executes with its own env? Is there a better remote execution tool I can try or are there any other features of SSIS I can use to get around this issue? I need the results of the batch file and hence do not want to make it an asyncronous process.
Thanks
Sumeet
Good afternoon-
Can a batch file that resides on another server be executed from a different machine? I have a batch file that resides on a server that I would like to run using SQL 2005 Integration Services. Is there anything I can do that would allow me to remotely execute this batch file and have it run in that environment.
BATCH FILE:
cd C:Trandev
otrun -at OTRecogn.att -DINPUT_FILE=%1 -tl 1 -cs dv -lg mylog -I
C:Trandev represents the remote environment
I have tried mapping the remote machine to a network drive on my local machine and using that drive to execute the batch file in an Execute Process Task, but it does not work.
SSIS:
I have a FOR EACH loop grabbing files and writing fileName to a variable that is passed to the Process Task as an argument through an expression(%1 in the batch file above). The Working Directory is a mapped network drive. The Executable is also a network drive plus batch file name.
Any help would be appreciated.
My computer is a HP Compaq dc7100, 512mb RAM, WindowsXP
I am new to this, but have scoured the web and not found an answer to my question...
I have an execute process task that runs a simple batch file. When this batch file completes with an ERRORLEVEL greater than 0, I would like the task to fail. I thought this simply meant setting the "FailTaskIfReturnCodeIsNotSuccessValue" property to true, and setting the SuccessValue to 0. However, this does not appear to work.
Even with a simple batch file forcing the errorcode to 1 as follows, the task still completes "successfully".
SET ERRORLEVEL = 1
Any ideas? Thanks!
Hello,
I have an "execute process" task which executes a perl script. When I run the task, it shows a prompt with the message "the publisher can not be verified". It gives the option to continue the task or to cancel.
The problem for me is that I want to schedule this package to run automatically, and I don't want the automated process to show this dialog. I need to override the security setting and have SSIS execute my batch scripts without prompting. Assuming I don't want to rewrite the Perl code into a script task, is there a way to do acomplish this?
Thanks!
Arkadiy
Trying to run a SSIS package from a SQL job, and the package itself has a step that calls a process task that runs a batch file. The syntax in the process task I have is the following:
executable: c:windowssystem32cmd.exe
Arguments: /C e:SungardPTAencryptfile.bat
Working Directory: e:sungardpta
I keep getting the following in my log:
PackageStart,MIMKEIMC11N,MI rustserviceadmin,PTADailyTransactionExtract,{46F7381F-B345-47DC-BFC0-17CCF02A935A},{F82C7944-D28C-4F70-8CB7-F0BD7ED748D2},1/29/2008 1:59:11 PM,1/29/2008 1:59:11 PM,0,0x,Beginning of package execution.
OnError,MIMKEIMC11N,MI rustserviceadmin,EncryptFiles,{FCF5B653-CC05-4183-981B-F5EF4906DD09},{F82C7944-D28C-4F70-8CB7-F0BD7ED748D2},1/29/2008 1:59:12 PM,1/29/2008 1:59:12 PM,-1073573551,0x,In Executing "c:windowssystem32cmd.exe" "/C e:SungardPTAencryptfile.bat" at "e:sungardpta", The process exit code was "1" while the expected was "0".
OnError,MIMKEIMC11N,MI rustserviceadmin,PTADailyTransactionExtract,{46F7381F-B345-47DC-BFC0-17CCF02A935A},{F82C7944-D28C-4F70-8CB7-F0BD7ED748D2},1/29/2008 1:59:12 PM,1/29/2008 1:59:12 PM,-1073573551,0x,In Executing "c:windowssystem32cmd.exe" "/C e:SungardPTAencryptfile.bat" at "e:sungardpta", The process exit code was "1" while the expected was "0".
OnTaskFailed,MIMKEIMC11N,MI rustserviceadmin,EncryptFiles,{FCF5B653-CC05-4183-981B-F5EF4906DD09},{F82C7944-D28C-4F70-8CB7-F0BD7ED748D2},1/29/2008 1:59:12 PM,1/29/2008 1:59:12 PM,0,0x,(null)
PackageEnd,MIMKEIMC11N,MI rustserviceadmin,PTADailyTransactionExtract,{46F7381F-B345-47DC-BFC0-17CCF02A935A},{F82C7944-D28C-4F70-8CB7-F0BD7ED748D2},1/29/2008 1:59:12 PM,1/29/2008 1:59:12 PM,1,0x,End of package execution.
Any help would be greatly appreciated
hi,
i have designed DTS packages, I have a script component that picks up the 'Path' of a file stored.
The Path is a column in database and that obtained from OLEDB source.
now i need to zip the files in the path given above and than store it in some location. How do I do that?
I have an execute process task in SSIS that executes a .Net program.When this is running as a Sql Server Agent job in Sql Server 2005, I have no issues. The operating system of the server is Windows Server 2003 R2.
Now I'm trying to get this working as a Sql Server Agent job in Sql Server 2012. The operating system of the server is Windows Server 2012 R2. And now I have issues.
If I run the SSIS package in Visual Studio debug mode, I have no issues! It's only when I try running the same package from a Sql Server Agent job that there are problems. The .Net program errors out with a System.TypeInitializationException.
I thought this might be an issue running the .Net program as 64 bit so I changed the agent setting to 32 bit. That didn't work. I thought it might be an issue with authorization (since I can run it in debug with me as the user). I put in a class in the program that changes the user through impersonation. That didn't work either.
Since I don't have a full-blown version of Visual Studio on the database server, I haven't been able to capture the error and debug the program to see where it is blowing up.
why something like this would work in Sql Server 2005/Windows 2003 but not in Sql Server 2012/Windows 2012 when run as an agent job? And on top of that, why would it work when I run it manually in debug mode but not when run as an agent job?
I'm trying to use "findstr.exe" to extract some lines of interest from a data file, which I will later load to a table. I'd like to issue this form of a command:
findstr.exe "^SEARCHSTRING" "srcfile" > "dstfile"
I build the arguments using expressions, and both the search string and source file get correctly set. However, the ">" seems to be ignored--I can see the lines spitting out to the temporary window when I run under VS.
QUESTION: how do you redirect the output of a command run under an Execute Process Task?
Dear list
Im designing a package that uses Microsofts preplog.exe to prepare web log files to be imported into SQL Server
What Im trying to do is convert this cmd that works into an execute process task
D:SSIS ProcessPrepweblogProcessLoad>preplog ex.log > out.log
the above dos cmd works 100%
However when I use the Execute Process Task I get this error
[Execute Process Task] Error: In Executing "D:SSIS ProcessPrepweblogProcessLoadpreplog.exe" "" at "D:SSIS ProcessPrepweblogProcessLoad", The process exit code was "-1" while the expected was "0".
There are two package varaibles
User::gsPreplogInput = ex.log
User::gsPreplogOutput = out.log
Here are the task properties
RequireFullFileName = True
Executable = D:SSIS ProcessPrepweblogProcessLoadpreplog.exe
Arguments =
WorkingDirectory = D:SSIS ProcessPrepweblogProcessLoad
StandardInputVariable = User::gsPreplogInput
StandardOutputVariable = User::gsPreplogOutput
StandardErrorVariable =
FailTaskIfReturnCodeIsNotSuccessValue = True
SuccessValue = 0
TimeOut = 0
thanks in advance
Dave
How do I use the execute process task? I am trying to unzip the file using the freeware PZUnzip.exe and I tried to place the entire command in a batch file and specified the working directory as the location of the batch file, but the task fails with the error:
SSIS package "IngramWeeklyPOS.dtsx" starting.
Error: 0xC0029151 at Unzip download file, Execute Process Task: In Executing "C:ETLPOSDataIngramWeeklyUnzip.bat" "" at "C:ETLPOSDataIngramWeekly", The process exit code was "1" while the expected was "0".
Task failed: Unzip download file
SSIS package "IngramWeeklyPOS.dtsx" finished: Success.
Then I tried to specify the exe directly in the Executable property and the agruments as the location of the zip file and the directory to unzip the files in, but this time it fails with the following message:
SSIS package "IngramWeeklyPOS.dtsx" starting.
Error: 0xC002F304 at Unzip download file, Execute Process Task: An error occurred with the following error message: "%1 is not a valid Win32 application".
Task failed: Unzip download file
SSIS package "IngramWeeklyPOS.dtsx" finished: Success.
The command in the batch file when run from the command line works perfectly and unzips the file, so there is absolutely no problem with the command, I believe it is just the set up of the variables on the execute process task editor under Process. Any input on resolving this will be much appreciated.
Thanks,
Monisha
I am designing a utility which will keep two similar databases in sync. In other words, copying the new data from db1 to db2 and updating the old data from db1 to db2.
For this I am making use of the 'Tablediff' utility which when provided with server name, database, table info will generate .sql file which can be used to keep the target table in sync with the source table.
I am using the Execute Process Task and the process parameters I am providing are:
WorkingDirectory : C:Program Files (x86)Microsoft SQL Server90COM
Executable : C:SQL_bat_FilesSQL5TC_CTIcustomer.bat
The customer.bat file will have the following code:
tablediff -sourceserver "LV-SQL5" -sourcedatabase "TC_CTI" -sourcetable "CUSTOMER_1" -destinationserver "LV-SQL2" -destinationdatabase "TC_CTI" -destinationtable "CUSTOMER" -f "c:SQL_bat_Filessql5TC_CTIsql_filescustomer1"
the .sql file will be generated at: C:SQL_bat_Filessql5TC_CTIsql_filescustomer1.
The Problem:
The Execute Process Task is working fine, ie., the tables are being compared correctly and the .SQL file is being generated as desired. But the task as such is reporting faliure with the following error :
[Execute Process Task] Error: In Executing "C:SQL_bat_FilesSQL5TC_CTIpackage_occurrence.bat" "" at "C:Program Files (x86)Microsoft SQL Server90COM", The process exit code was "2" while the expected was "0". ]
Some of you may suggest to just set the ForceExecutionResult = Success (infact this is what I am doing now just to get the program working), but, this is not what I desire.
Can anyone help ?
I have a SSIS package with the last three tasks in the control flow are stopping the SSAS, then "on success" the second last task is execute a batch file to copy a bunch of files to a remote server using the robocopy command, then "on success" the last task is to start the SSAS. I test all three tasks individually and they are all working fine. The problem is in-between the second last task and the last task, the second last task is to execute a batch file and then forward to the last task. The task just moved to the last task once the batch file is executed and it did not wait until the actual robocopy job is completed. Therefore it caused a problem in the robocopy process. Thanks.
View 1 Replies View RelatedI want to pass in a text file to execute process task.Is it possible???????
View 1 Replies View RelatedHello all,
I have the need to connect to a network drive as a different user id when my SSIS package runs. If I stick the command into a batch script (forums don't play well with Opera, so sorry for code block not working)
@echo off
C:windowssystem32cmd /c net use \ServereeShare SecretPassword /usererverSecretUser
If I call that batch script from SSIS, at the conclusion of execution I'll have a share mapped. To ease deployment and maintenance, I want to refrain from using the batch script. So, I set my task as so
Executable: cmd.exe
Arguments: /C
WorkingDirectory: C:windowssystem32
StandardInputVariable: User::FileShareMappingParameters
StandardOutputVariable: User::FileShareMappingOutput
StandardErrorVariable: User::FileShareMappingError
and the rest are the default values. The value of User::FileShareMappingParameters is "net use \ServereeShare SecretPassword /usererverSecretUser"
My task does not fail nor do the output or errors variables get populated but I do not get my share. Anyone out there run into a similar situation or have a pointer on this one?
Hi,
We have an SSIS Execute Process Task which calls an executable along with the required parameters.
When we run this package, it intermittently gives the error as shown below in red
Executing "ppscmd.exe" "StagingDB /Server http://SERVERNAME:46787 /path OSB_FY08.Planning.dimensionECFuncArea /Operation LoadDataFromStaging" at "", The process exit code was "1" while the expected was "0". End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 5:05:08 PM Finished: 5:08:40 PM Elapsed: 212.203 seconds. The package execution failed. The step failed.
We are not able to debug this issue. We had a look at the logging information as well but we are not getting any information on this issue.
How can we resolve this issue ?
Any help on this would be highly appreciated.
Thanks & Regards
Joseph Samuel
Hi,
I am trying to exectue batch file which is located on other server. Can someone explain how to use execute process task?
I can see Executable ,Arguments, working directory, standard input v ariable, standard output variable, Fail task if return code is not success, success value when I open execute process task .
Also when I try to execute the batch file I am getting "Publisher could not be verified window and then its working after clicking the RUN button on the message. How can I avoid this in SSIS ?
For example I have the batch files located in some location \112.156.82.9\BATCHFILES\FILENAME
A batch file when being executed using the "execute process task"(DTS package) gives problems whereas the same batch file without any change when executed manually from the explorer runs fine.
The problem in debugging is that sometimes the same task runs fine and sometimes not....
The batch file contains code to extract a zip file(zipped using arj) to a paricular directory.
any ideas????
In the properties sheet for a DTS Execute Process Task, there is a input box for 'Parameters' which allow you to add command-line options to the task exe specified. How can you use the DTS Global variables to be passed in this parameter field? Is there a special format to indicate that the parameters are in fact global variable tokens?
View 1 Replies View RelatedWe are attempting to use SSIS execute process task.
In a cmd.exe session the executable runs with normal arguments:
mycmd < myscript.txt > foo.txt 2>error.txt
We have attempted to several permutations of this without success. We declared variables and assigned them to stdin, stdout, stderr. However, mycmd opens in the SSIS session as if no arguments have been supplied.
Is there some expression that is required to connect the stdin/out/err variables in the Arguments within Execute Process Task. The help/examples are terse.
Hi,
I have what should be a very simple process.
I have a FOREACHLOOP container, that is set up to loop through files in a directory:
Enumerator: Foreach File Enumerator
Folder: c:myfolder
Files: *.txt
Retrieve: Name and extension
Variable mappings: User::file_name, Index 0
So far, so good...
Then, inside the FOREACHLOOP, I have an Execute Process Task, which is simply a .bat file that I am running, and passing the name of the file to:
For example: myBat.bat file_name
In the Execute Process Task, I have:
RequireFullFileName: false
Executable: c:myFilemyBat.bat
WorkingDirectory: c:myFile
StandardInputVariable: User::file_name
Everything else is set to the defaults.
However, when I execute my container, I get the following error:
Error: 0xC0029151 at Execute Process Task, Execute Process Task: In Executing "c:myFilemyBat.bat" " " at "c:myFile", The process exit code was "1", while the the expected was "0".
Is there anything I am obviously doing wrong here at the package level? When I run the .bat file from the command line, it works fine.
Thanks
My problem is that I am trying to set up an Execute Process Task to run a C# executable. The .exe captures information from an ftp site and downloads it into a directory on our server. Here is the command line run:
C:SAXOEodinReleaseSaxoEod
I have set the Execute Process Task up as follows:
Require Full name: True
Executable: C:SaxoEODobjReleaseSaxoEod.exe
FailTaskIfReturnCodeIsNotSuccessValue: False
SuccessValue:0
TimeOut:0
WindowStyle:Normal
I have the FailTaskIfReturnCodeIsNotSuccessValue set to False because when it is set to true I get the following error:
Error: 0xC0029151 at Execute Process Task, Execute Process Task: In Executing "C:SaxoEODobjReleaseSaxoEod.exe" "" at "", The process exit code was "-532459699" while the expected was "0".
Setting FailTaskIfReturnCodeIsNotSuccessValue to False does not work either because the files are not downloaded from the FTP site.
I am relatively new to the SSIS arena. I have googled this thing to death and have not found an answer. Any help in the right direction is appreciated. Thanks.
Dave Christman
Hi!
I need help with some C# code. I have build a SSIS package with an Execute Process Task. I need to send dynamic variables in to my C# program so I thought it was a good idea to use the StandardInputVariable.
How do I get the variable in my C# code?
Thanks
Carl
Hi
I am having trouble running a package in SQL Agent. The step involves zipping up a number of files using SQL Agent. I know in the error message it states "Access is denied" but I can run the package manually in BIS. Also I have applied a SQL proxy to the step using my own credentials which have rights to the file location, but still no luck.
I get the following error:
Error: 2008-03-10 09:04:02.04 Code: 0xC002F304 Source: Call ZipFiles Batch Execute Process Task Description: An error occurred with the following error message: "Access is denied". End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 09:04:00 Finished: 09:04:02 Elapsed: 1.219 seconds. The package execution failed. The step failed.,00:00:02,0,0,,,,0
Does anyone know what the problem could be?
Thanks
HI,
Is it possible to provide variables ( multiple variables ) in the arguments parameters of the Execute Process Task?
Thanks
Shafiq
On an Execute Process Task, are there properties I can examine to determine the outcome of a process? I know that I can use a Success/Failure constraint to direct my workflow appropriately, depending on the outcome, but I would prefer the workflow continue on to the same task regardless, and then be able to change the flow later on based on the outcome of the process.
I see there is an ExecValueVariable property, and this may be what I'm looking for, but I have no idea what this is and can not find any documentation on it. I tried using it, but kept getting a runtime error trying to set it to a variable.
I know that a process returns a numeric value, and it would be nice if I could store this somewhere.
Any suggestions?
Thanks in advance.
Jerad
Hi All,
Would you please clarify me how to use or setup Execute Process Task, i have seen the document from microsoft but i need more detail and if possible example how to setup. what does it mean by Executable, Arguments, Working Directory, StandardInputVariabl, StandardOutputVariable and some example respectively. And how do wee set them with example, especially taking taking zip/unzip executable file. Please i need help and make it clear example. I really appreciate for your time in advance.
Greetings!
I am using a Excute Process Task calling a selfwritten EXE and I'm trying to pass a command line argument to it. The code for the EXE is quit simple:
Public Sub Main()
Try
Dim info As String = My.Application.CommandLineArgs.Item(0)
MessageBox.Show("Info:" & info)
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
According to the help files there are two ways to pass an argument, using the property Arguments, which I guess is for hard-coded stuff, and the StandardInputVariable for passing dynamic info.
When I use the Arguments property everything works fine. I get the info messagebox with correct data. But when I leave that blank and instead use the StandardInputVariable property setting it to my package variable User::Info then I crash into an exception meaning that no arguments existed (array is out of bonds).
The variable User::Info was at first filled from a previous SSIS task and using the OnPreExecute breakpoint I verified that it contained a stringvalue. I then hardcoded a string value into the variable, but nothing helps. The task refuses to start my EXE with the data in the StandardInputVariable as an argument.
Why is this not working???
Hi,
For the Execute Process task (such as for running .bat files), what is the "Working Directory" for?? Should it be set to the directory that contains the .bat file, for example?
Can't find any documentation in BOL.
Thanks
Hi,
I would like to ask someone who could help me with one small problem:
I would like to run SQL server task on one of my servers, that will connect
to all other servers (including ones that are not SQL servers, ie: Exchange,
Test Server etc) one at the time, and that will execute one batch file (update.bat) that is residing on each server under C: drive.
Batch file will copy some things from all of the servers to one server.
Thanks, in advance.
Regards,
Vilko
I'm trying schedule a batch file to run as a job from sql server agent. The batch file copies files from one server directory to a directory on another server. The batch file works properly when executed directly. The job is being executed under the sql service account login. I've given the service account access to both the source and destination directories.
When I try to run the job it fails with an "Access is denied" error on both the source and destination directories (as read from job history).
Any ideas?
Hi All,
I would like to embed some stored procedures in a batch file and execute it from the command prompt on windows.
I have no idea of how to embed a stored proc in a .bat file.
Can you please redirect me to the solution to this?
Thanks in advance
vishu
Is it possible to use sql to execute a batch file? I would like toexecute the following "C:BTWartend.exe /f=C:BTWToolboxFormatscarnum.btw /p", 6Thanks,Matt
View 6 Replies View Related