September 19, 2017 at 12:13 pm
I have created a Execute Process task that runs a .bat file. This bat file creates a very small .txt file. When I execute the .bat file directly from windows explorer it runs successfully and creates the text file, but when I execute the process task in ssis it fails but it's not giving me a specific error desc other than "the process exit code was "1" while the expected was "0", AND, it doesn't create the text file.
[Execute Process Task] Error: In Executing "\\MAINDRIVE\subfolder$\dept_folder\Inbound\Create_DONE_File.bat" "" at "\\MAINDRIVE\subfolder$\dept_folder\Inbound", The process exit code was "1" while the expected was "0".
The code inside the .bat file is
ECHO OFF
fsutil file createnew "\\MAINDRIVE\subfolder$\dept_folder\Inbound" >"DONE_FILE.txt" 53248
Has anyone come across this error before? if so, what could be the issue?
September 19, 2017 at 1:28 pm
From my experience there could be a whole handful of possible causes. Permissions, how wscript.exe or cscript.exe is invoked, etc.
I would try variations of whether you have cscript.exe + the bat path, or wscript.exe + the bat path, etc. Basically play with the syntax of the actual task or command path ...
I've usually had to include cscript.exe for vbs's, anyway ... this may get you thinking...
September 20, 2017 at 6:36 am
BI_Developer - Tuesday, September 19, 2017 12:13 PMI have created a Execute Process task that runs a .bat file. This bat file creates a very small .txt file. When I execute the .bat file directly from windows explorer it runs successfully and creates the text file, but when I execute the process task in ssis it fails but it's not giving me a specific error desc other than "the process exit code was "1" while the expected was "0", AND, it doesn't create the text file.
[Execute Process Task] Error: In Executing "\\MAINDRIVE\subfolder$\dept_folder\Inbound\Create_DONE_File.bat" "" at "\\MAINDRIVE\subfolder$\dept_folder\Inbound", The process exit code was "1" while the expected was "0".
The code inside the .bat file is
ECHO OFF
fsutil file createnew "\\MAINDRIVE\subfolder$\dept_folder\Inbound" >"DONE_FILE.txt" 53248Has anyone come across this error before? if so, what could be the issue?
Usually, you need to be sure of at least two things.
1.) The SSIS package runs under the security context of whatever made it execute, so if you run it via a SQL Agent Job, then the account that the Agent runs under will need appropriate permissions to the folder location(s?) that the script touches, including any parent folders that script might navigate or list files (or directories) from. Alternatively, if you run the SSIS package via the Windows Scheduler, then whatever user is logged on and running that scheduled task would need those same permissions.
2.) The script being run does not assume what drive letter and/or folder is the "current folder". This one is a pretty common mis-step, as you don't have control over that, so your batch file should be forcing it.
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
September 20, 2017 at 6:41 am
Now that I've looked more closely at your batch file, there's a number where I'd guess it doesn't belong.
What is the significance of the 53248 ? It appears AFTER a command line output redirection destination,
and probably isn't having any effect on the fsutil program, so if it needs to, that may also be a problem.
Either that or the redirection doesn't work right and the Execute Process Task fails due to a syntax error.
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
September 20, 2017 at 8:25 am
It looks like it's not seeing the filename and size. Did you try:
fsutil file createnew "\\MAINDRIVE\subfolder$\dept_folder\Inbound\DONE_FILE.txt" 53248
Sue
September 20, 2017 at 8:40 am
Thanks all,
Steve,
The 53248 is the size of the text file I want. Basically it's telling the process to create a minimal text file of 56 KB in size.
Sue,
I went ahead and enclosed the file name inside the quote marks, and changed to echo on and pause to see what's happening and it looks like to be able to execute the fsutil utility I need to have admin rights (screen shot below). Is there a way to do simple cmd.exe create file command?
\\MAINDRIVE\subfolder$\dept_folder\Inbound\>ECHO ON
\\MAINDRIVE\subfolder$\dept_folder\Inbound\>fsutil file createnew "\\MAINDRIVE\subfolder$\dept_folder\Inbound\DONE_FILE.txt" 53248
The FSUTIL utility requires that you have administrative privileges.
\\MAINDRIVE\subfolder$\dept_folder\Inbound\>PAUSE
Press any key to continue . . .
September 20, 2017 at 8:42 am
One thing I'll try to debug things like this is use a simple command and direct the output to a file. For example:
dir \\MAINDRIVE\subfolder$\dept_folder\Inbound > output.txt
Just to check permissions and can I see the file/folder.
September 20, 2017 at 9:02 am
The 53248 is the size of the text file I want. Basically it's telling the process to create a minimal text file of 56 KB in size.
Just a quick aside: I think you meant 52kB.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
September 20, 2017 at 10:22 am
If you are sure you have permissions to that directory - check what Steve Jones showed you - then try doing something like:
@echo off
break>"\\MAINDRIVE\subfolder$\dept_folder\Inbound\DONE_FILE.txt"
Sue
September 20, 2017 at 11:01 am
Looks like there is a C# way of doing this, if you're happy doing some scripting. A quick Google turned this up:
private void CreateDummyFile(string fileName, long length)
{
using (var fileStream = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None))
{
fileStream.SetLength(length);
}
}
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
September 25, 2017 at 8:52 am
Does the executing user in SSIS have Access to the Folder and permission to execute the Batch file?
September 26, 2017 at 9:04 am
Thank you all for your input. I was out of the office, but now that I'm back, I'll explore each of the posts and report back with findings.
September 26, 2017 at 2:29 pm
I had got same error so i check by putting echo on and see what is issue after each line.
For me it is issue for % in the password of SFTP site. I was using Winsscp and putting my file over in SFTP Site.
September 27, 2017 at 7:25 am
sks_989 - Tuesday, September 26, 2017 2:28 PMI had got same error so i check by putting echo on and see what is issue after each line.
For me it is issue for % in the password of SFTP site. I was using Winsscp and putting my file over in SFTP Site.
So, have you resolved the problem then?
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
September 27, 2017 at 7:45 am
Yes Steve we resolved issue by removing ! character from password.
Viewing 15 posts - 1 through 15 (of 18 total)
You must be logged in to reply to this topic. Login to reply