Execute Process Task configuration for WinSCP
Hi Experts,
I've been tasked to use WinFTP to pull files from an sFTP site to our local W2007 server using an SSIS Execute Process Task. I'm trying to get the task to run a script containing the UN/PW and other info, text below. The script works from the
command line:
Here's the Process window from the task:
When I run the task, the error says Host "\script=C" does not exist. Are there some special characters I need to use around the colon or something? It's like the task isn't sending the complete path.
Here's the text of the script, in case it matters.
option batch abort
option confirm off
open sftp://User:Password@site
get Media*2013.txt C:\FTP\
get Media*2014.txt C:\FTP\
close
exit
None of the recommended solutions I've found have worked for me. Help!?! Please???
Thanks in advance!
Look at this example, i remeber doing this where a profile needs to be created in advance via the console this profile then need to be accessed via the script, this link should help you it has an example belo
http://winscp.net/eng/docs/scripting
Look at this aswell
http://winscp.net/eng/docs/guide_automation#script_file
# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open sftp://user:[email protected] -hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
# Connect
open sftp://[email protected] -hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
# Change remote directory
cd /home/user
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
get examplefile.txt d:\
# Disconnect
close
# Connect as a different user
open sftp://[email protected]
# Change the remote directory
cd /home/user2
# Upload the file to current working directory
put d:\examplefile.txt
# Disconnect
close
# Exit WinSCP
exit
Abhinav http://bishtabhinav.wordpress.com/
Similar Messages
-
Execute process task argument is not working for sph file and ogr2ogr.exe
Hi All,
I am trying to load shape file into a sql spatial table. A execution process task is used to run the ogr2ogr.exe program.
This is how the process tab looks like .
Executable : C:\gdal_ogr2ogr\bin\gdal\apps\ogr2ogr.exe
Argument : -f MSSQLSpatial MSSQL:server=SQL-ABC-DEV;database=MYSIMPLE_Dev;Trusted_Connection=True;\\mypath\files\shares\Data\www.mypage.htm\my_sample_file.shp
Success value : 1 (I am not sure why I need to change this value from 0 to 1.
For above settings, package runs fine. However the spatial table is not created always. It is created once in a while after switching Success value from 1 to 0 and 0 to 1 again. (After the spatial table is created, it is dropped using a execute sql statement).
I am running this in VS 2012.I saw in an article that we need to convert shp file to csv before we load it into sql server.I even tried to convert shp to csv using execute sql task and ogr2ogr.exe. Still the package runs successfully after changing Success
value from 0 to 1 but no csv file is created. If the success value is 0, it throws the following error.
[Execute Process Task] Error: In Executing "C:\gdal_ogr2ogr\bin\gdal\apps\ogr2ogr.exe" " -f CSV \\xxxxxxxxr.rdn\files\shares\xxx_Data\ImportData\www.xxxxxxx.hapepage.htm\xxxxxx\Watches\Warnings\myfile\CSV \\xxxxxxxxr.rdn\files\shares\xxx_Data\ImportData\www.xxxxxxx.hapepage.htm\xxxxxx\Watches\Warnings\myfiles\www.shp"
at "", The process exit code was "1" while the expected was "0".
Could long file name be a problem too?
Thanks for your help in advance..
shamenHello shamen,
Seems to me you are missing a step to check if the shape is there and purge it before loading if so.
Arthur My Blog -
Using UNC Path With Execute Process Task
I have an Execute Process task in which the process can either delete, get or put files to an SFTP site. The executeable takes arguments in the following format:
"host" "user" "password" "put" "full local path/filename" "full remote path/filename"
I have the task configured as follows:
RequireFullFileName: True
Executeable: \\server\groups\Development\ETLFiles\ETL_Utilities\ocsshhelper\ocsshhelper.exe
Arguments: sftp user password \\server\groups\Developmement\ETLFiles\ETL_Data_Files\CT_FS_Export_20081113.csv stateExport\export
WorkingDirectory: \\server\groups\Development\ETLFiles\ETL_Utilities\ocsshhelper
WindowStyle: Hidden
Arguments, Executeable and WorkingDirectory have been configured as Expressions. When I execute the package in BIDS from my Windows XP SP3 machine, The task fails with the following error:
[Execute Process Task] Error: In Executing "\\server\groups\Development\ETLFiles\ETL_Utilities\ocSSHHelper\ocsshhelper.exe" "sftp user password put \\server\groups\Development\ETLFiles\ETL_Data_Files\CT_FS_Export_20081113.csv stateExport\export" at "\\server\groups\Development\ETLFiles\ETL_Utilities\ocSSHHelper", The process exit code was "-532459699" while the expected was "0".
My domain account has 'effective' full control rights to the location of ocsshhelper.exe.
It could be that the executable does not support UNC paths, and I'm checking that. I have another package that uses this same application, but uses the physical path, and there are no problems. Does the Execute Process task have issues with UNC paths?
Thank you for your help
cdun2Actually it doesn't work properly in SQL Server 2008 R2. I have a similar EP task. If I set the working directory to \\server\share\subdir the task fails. However, if I map a drive latter to the \\server\share and set working directory to <drive>:\subdir
it works -
SSIS Execute Process Task DDE/OLE
I have a package that executes an executable via Execute Process task, and that executable needs Adobe Reader to work. It sends PDF faxes to Adobe which converts them to tiff. This is a third party executable that is part of an enterprise Fax
Server so I have no control over changing the process at all. This being said, for whatever reason, it wont run as a SQL job. When the executable runs, it is passed a file name. It (the EXE) opens Adobe via DDE/OLE, not sure, it just launches
it, and covnverts/sends the fax.
It runs under BIDS with my authority, it runs under BIDS with SQLADMIN authority
It runs as a "deployed" package (right click choose run job) under the same authority as the SQL job is (SQLADMIN)
It runs from the command line with DTEXEC
When executed as a JOB, calling the DTSX from the catalog, it does not throw an error, but through debugging, we've found it stops at the executable, because the executable can't launch the Adobe instance. It continues to run and never fail, but not do
anything.
Is there something in SSIS (2012) that I need to configure to allow this to work?.
Thanks!!Unfortunately, the Proxy didn't help. I had made one before, but I followed the article just in case I had done something incorrect. To summarize, the package calls an execute process task which runs a program called SendFax,exe and passes it
a filename. SendFax.exe internally instantates Adobe Reader and uses it for conversion from PDF to TIF. Outside of the SQL Agent job it runs fine. When launched by the Agent, it fails to instantate Adobe.
Also, when the dtsx is run from the command line using DTEXEC it runs fine. Putting the command line in a batch file and double clicking it, it runs fine. Executing that same batch file with "Highest permissions" in Windows Task Manager, it fails
as well.
Finally, I made a simple SSIS to launch AcroReader32 (in a 32 bit instance) in SSIS but putting out an execute process task that does nothing but launch Adobe, it fails. I remove Adobe 11 and installed 10.1, it still fails. I turned off all the security
in Adobe reader I could find, and it still fails.
This is making me crazy..... -
Pass Passord Variable to a Batch File using Execute Process Task
I have an FTP batch file that I want to execute using Execute Process Task. The content of the ftp (ftpscript.cmd) is as below:
open ftpsite
UserName
Password
ASCII
get file c:\temp\test.txt
bye
Using SSIS Execute process task, I was able to download data. I configured the Execute Process task as follows:
Executable: ftp.exe
Arguments: -s:"c:\temp\ftpscript.cmd"
The above works fine. But the problem is that I don't want to store the password value in the batch file for security/policy reasons. Please, is there a way I can pass the password value to the ftp executable or the batch file at run time?
I know how to get and store variables in SSIS but I don't know how to pass this kind of variable to the batch file just before execution.
Any suggestions will be appreciated. Thanks.you can dynamically generate the source (CMD) for the FTP and delete after the execution. The password can be stored in a secure database for example, not 100 % secure, but the best you can do.
Another option I did was an encrypted VBScript (also quite easy to open in plain text to some people).
Finally it can be a binary e.g. an EXE with the FTP called as process in it.
Arthur My Blog -
Execute Process Task :Executing DOS Command lines in Execute Process Task
Hi All,
I am trying to sftp files using Tectia Client from my local system. For that I have used the Execute Process Task in SSIS. First I open DOS command and try to instantiate the sftp3.exe.
Then I write down the below command
binary
open username@hostname
lcd C:\Test
cd <Destination Path name>
put test.txt
How to execute the command in execute process task ?
help is appreciated
ThanksHi ConnectDebz,
According to your description and script example, do you use WinSCP.exe to perform the SFTP files transfer? If so, you should set the Executable of the Execute Process Task to the path of the WinSCP.exe, save the script in a .txt file and set the Argument
of the Execute Process Task like “/script=C:\Temp\sftploader.txt” (without quotes).
References:
http://www.sqlservergeeks.com/blogs/raunak.jhawar/sql-server-bi/395/sql-server-sftp-with-ssis-execute-process-task
http://gregcaporale.wordpress.com/2012/02/23/using-sftp-in-sql-server-ssis/
Regards,
Mike Yin
If you have any feedback on our support, please click
here
Mike Yin
TechNet Community Support -
Hi,
Can you please let me know the list of the command prompt switches used in execute process task of SSIS for arguments with their functionality?It depends on what command prompt utility you're calling inside.Arguments property of Execute process task accepts arguments as defined in your utility which you're using inside it
For example if you're calling bcp you can use all switches of bcp like -c ,-T,-S etc
similarly for WinSCP you just need to pass -script = <Script File path>
So you cant standardize the arguments list
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Execute Process Task - How to output command?
Hello everyone,
I'm currently running an SSIS package that reaches out to a remove SFTP server and pulls files to my local server. I've recently run into a problem where it's not properly pulling a list of the files on the remote server (so that I can pull them each
one at a time and log the transfer). Part of the solution is utilizing an execute process task object to call the SFTP client (in this case WinSCP) and issue a command to connect to the remote server and request a list of the files in the remote folder:
Executable
C:\WinSCP\WinSCP.com
Arguments
/command "open sftp://user:[email protected]:10022/folder" "option confirm off" "ls files*.csv" "exit"
The arguments line is put together via an expression, the file group query (ls files*.csv) changes to different types of files as I loop through them to get grouped lists (ls files*.txt, ls files*.gz, etc.). Now what I'm trying to look for is a way
to have the actual command executed outputted to the output window, variable, or file so that I can see what's actually being put together via expression. I imagine this is just an option somewhere that I can toggle on but I haven't been able to find
it in BIDS. Any help is appreciated.
Thanks,
GlenHi Tom,
I went ahead and did that, it now exits but I still don't have a log file. I did check the online documentation at the link you provided and it looks like it's in order. Currently the command looks like this:
WinSCP.com /command "open sftp://user:[email protected]:10022/folder" "option confirm off"
"ls files*.csv" exit "/log "C:\MyWinSCPSession.log""
I've tried a couple other variations, playing around with moving around the quotes but no dice. I don't even get an error message. I can confirm that there are files with
the exact file mask I'm looking for on the target server and that the command works when I type it manually (without the logging). Any additional help is appreciated.
Thanks,
Glen
*Note: I should add that when I execute the command above, it does all other tasks successfully...search and connect to host, authenticate username/password, start session, output
file list, etc. and it's all printed out in the command window. It just doesn't seem to want to log anything. -
Execute SSIS Package from JOB which contains Execute Process Task calling a .bat file
Hi All,
I have a EXCEL Macro needs to be called from SSIS. We could not use Script task because of some internal reason.
So we have taken an approach to call a .BAT file using Execute Process Task. This .BAT file will call a .VBS file which will execute the EXCEL Macro.
The SSIS Package is running good if I execute the package from BIDS.
But the real problem is with the scheduling this SSIS Package using SQL JOB.
If i execute this SSIS package from SQL Server Job, its executing the whole package successfully except the Execute Process Task.
So the overall issue is SQL Server Job is not executing properly if I call any .BAT file from the SSIS Package.
Please give me suggestion to get rid of the issue. Thanks in advance.Hi Sai.N,
If you run the SQL Server Agent job manually from SSMS, does the package execute properly? If the package executes properly when you run the job manually, the issue should occur due to permission issue. In this case, I suggest that you create a SQL Server
Agent proxy based on the current Windows account which you use to log onto the operating system, and run the job under the proxy account.
If it is not the issue, please enable logging in the package as Visakh mentioned and post the warning/error message for further analysis.
Regards,
Mike Yin
TechNet Community Support -
Execute Process Task showing all the SSIS Config variables in SQL Job History
Hi,
Am using an Execute Process task to execute my child package. And executing the Parent package from a SQL JOB.
I am using the same config file for both Parent and Child packages.
After the Job execution was Successful / Failure, in Job history it is showing all the variables from Config file which are not using in Child package. With the below message.
"The package path referenced an object that cannot be found"
I don't want to catch all the Variables information in Job History. Instead I need only the Success / Failure message.
PFA Screen.
Thanks,
Sailajasee
http://www.mssqltips.com/sqlservertip/1417/custom-logging-in-sql-server-integration-services-ssis/
https://www.simple-talk.com/sql/ssis/ssis-event-handlers-basics/
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
NOT able to call exe in ssis execute process task
I am creating an SSIS package in which we execute an exe file from the EXECUTE PROCESS COMPONENT which contains the logics and uses few sp’s which checks the expiry dates of the certificates of some URL's. But when we keep the file on sever and run it through
TWS it is showing the error "FILE NOT IN PATH" .But if we keep the exe file in local path then it executes through TWS. If we run the package locally without TWS then it runs successfully no matter if the exe is in local path or placed in a shared
server folder. So i want to know is there any constraints in running the EXE file from the shared folder through TWS.
Note:
1.TWS- IBM Tivoli workload scheduler to call and execute ssis packages
2. TWS is install in different server (Like server A)
3. SSIS package and exe file located in different server (Like server B)
4. We are using dynamic path in SSIS package to locate SSIS package and exe file.Hi SR_MCTS,
According to your description, a package that execute an exe file with Execute Process Task can be executed successfully without using TWS or the exe file stores in local path with TWS. While it fails when use TWS to execute the package with the exe file
stores in shared folder.
If in this scenario, it seems that the logon user that use TWS to execute the package has no access to the shared folder. We can logon as the relevant account or change some relevant settings on TWS to make sure the user has access to shared folder which
hosts the exe file.
Besides, since I’m not familiar with TWS, I’m not sure whether the issue is caused by there are some constraints in running the exe file from the shared folder through TWS. As to this issue about TWS, I suggest you post the question in the following forum:
https://www.ibm.com/developerworks/community/forums/html/forum?id=11111111-0000-0000-0000-000000002658&tags=tws. It is appropriate and more experts will assist you.
Thank you for your understanding.
Regards,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Execute Process Task error-Unzip Files
Dear All,
I have a SSIS package, that downloads a Zip file from FTP Server and extract and load that information in Sql Server Table. In my case every time I have only one file in FTP Server. There is no possible to get multiple files from FTP Server.
While at the time of executing SSIS package getting error at Execute Process Task(Unzip Files) i.e
Error Description :In Executing "F:\7z\7z.exe" " x F:\ZipFiles\Sales_010815.zip -oF:\ZipFiles\" at "", The process exit code was "2" while the expected was "0".
This error message getting while unzip my file.
Can some one help on this issue.
Regards,
Praveen C.
Regards, PraveenHi Praveen,
After testing the issue in my environment, I find the issue is caused by the code in Arguments is incorrect.
To fix this issue, please refer to the code below:
x F:\ZipFiles\Sales_010815.zip -oF:\ZipFiles
The following screenshot is for your reference:
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
SSIS execute process task error on unziping
Hi
I am using 7zip to unzip files in SSIS using execute process task. Here is the configuration of the task:
executable: C:\Program Files\7-Zip\7z.exe
arguments: e default-o\\servername\livechat\unzip\
However, on executing package in BIDS, following error is thrown
[Execute Process Task] Error: In Executing "C:\Program Files\7-Zip\7z.exe" "e \\servername\livechat\7566_20121009.zip-o\\servername\livechat\unzip\" at "", The process exit code was "2" while the expected was "0".
Can someone help where I made mistake?
Thanks,
hsbalI have mapped the share to F: and then tested. Unfortunately that doesnt work as well.
I am getting the following error:
[Execute Process Task] Error: In Executing "C:\Program Files\7-Zip\7z.exe" " F:\*.zip -o F:\unzip" at "", The process exit code was "7" while the expected was "0".
Thanks,
hsbal
Seems like a syntax error. Go through this
http://www.dotnetperls.com/7-zip-examples
Rajkumar -
Ssis execute process task error: process exit code was 1 while the expected was 0
Hi Sir,
in my SSIS Package(2012) i am using Execute Process Task which will call bat file. bat file is located on UNC Path.i am having the below script in the batch file.
del \\servername\foldername\name.txt
rcmd \\servername D:\name1.bat
del \\servername\foldername\name2.txt
xcopy \\servername\foldername\file.txt \\server\foldername\outfilefolder
i am getting the below error message:
ssis execute process task error: process exit code was 1 while the expected was 0
i want know at what cases error exit code was 1?
Thanks for your time.Hi prasad.alm,
The error is generic and can be caused by various factors. Here are some suggestions for your reference:
Manually run the executable to execute the batch file so that we can check whether the command lines in the batch file are correct or not.
Check there are no duplicate/existing files in the destination folder.
Try to run the package in 32-bit or 64-bit runtime mode.
If the issue occurs when running a job, try to create a CmdExec type job step to call the excutable. If this job also fails, it might be an issue between executable and SQL Server Agent rather than the SSIS package itself.
If the issue persists, enable logging for the package, and check if we can obtain more detailed error message for further analysis.
Regards,
Mike Yin
TechNet Community Support -
Hi Sir,
I have develop the SSIS Package in 2012 version and i am calling the SSIS Package using Stored Procedure according to my requirement and that stored procedure will be using in my SSRS report Datasource.
once after the SSIS Pacakge has design and develop and deploy into the server as Project Deployment model..when i run the ssis Package ,calling through the SP it is working fine...
even when i design a SSRS report using SSDT(sql server data tools), in the SSRS reprot calling the above SP in Dataset.when i execute the SSRS report it is wroking fine...
once SSRS report has been deployed into the remote Server.. when i Execute the SSRS report i am getting the below Error message:
SSIS-Execute Process task Error _File/Process "\\Servername\Foldername\batfile.bat" is not in path
belo is the SP for calling the SSIS package.
DECLARE @EXECUTION_ID BIGINT,
@PKG_RESULT INT
EXEC [SSISDB].[CATALOG].[CREATE_EXECUTION] @PACKAGE_NAME=N'abc.DTSX',
@EXECUTION_ID=@EXECUTION_ID
OUTPUT,
@FOLDER_NAME=N'aa',
@PROJECT_NAME=N'xxx',
@USE32BITRUNTIME=FALSE,
@REFERENCE_ID=29 --unique identifier for environment
EXEC [SSISDB].[CATALOG].[START_EXECUTION] @EXECUTION_IDWhere the BAT part is ?
It looks like a security issue.
The account running has no permission apparently over "\\Servername\Foldername\batfile.bat"
Arthur My Blog
Maybe you are looking for
-
Any ideas on how to get rid something (maybe) in our printer
We have a hp office jet 6500e709. We discovered tonite that something fell into it (maybe)& is keeping any paper from being fed into it. My dh tried to see what it is but wasn't able to see or hear anything. Does anybody have ideas as to what might b
-
How can I return to the previous version?
''locking this thread which was started back in February about Firefox 26 / 27'' Yesterday, while trying to get rid of the uninvited AVG elements in my Mozilla opening page I some how installed the latest version of Mozilla which I really dislike. Gi
-
Apple Push - What is it and why do I need it?
I have recently noticed a new "Apple Push" program in my processes that seems to start with startup on my Windows Vista SP2 machine with iTunes 10.5.3.3 installed. The only Apple products I use are iTunes/Quicktime with my 4th Gen iPod Nano so this p
-
Built in Bridge on TC endpoints
Hey, I am just new to the video side of things and I am trying to find out what TC endpoints have the 4 party built in bridge. Is there a document that can show me this? Thanks, Cameron
-
Canon Powershot G16 RAW files and CS5
I want to be able to work with Canon RAW files shot on my G16 but CS5 doesn't seem to support this. Is there a plug in? or do I need to purchase new/latest software? I really don't want to if I can help it - I have a budget and I'm quite happy with e