SSIS package execute application(. exe) file which is protected by password - ssis

I have a application (. Exe) file,
At the time of running, it is asking the password to process.
My task is to run that exe file using SSIS package and pass the static password at the runtime.
Kindly help me to resolve my issue.

It is a matter of making the Arguments as an expression. In that expression you can pass the entire command line string including the password. This when you expose it via Package Configuration, it can then be made dynamic. Here is a link that shows how a SQL Server Package is used to zip a file with password which you can use to tweak for your package - SSIS: How to Compress/Zip your file using 7-Zip?

Related

File System Move File doesn not work but Script Task System.IO does

I have an SSIS Package that as part of the process uses a File System Task to move a file to an archive folder.
The Source is a variable from a For Each Loop. The Destination is a File Connection with the connection string set to a Variable. The variable is static assigned in dev, and pulled from a package config when deployed.
Everything works in VS in the dev environment. I deploy to SQL Server and schedule with a SQL Job. Job fails. Immediately, I think it's a permissions issue but my Proxy has Modify to the destination and read on the source.
I then rewrite the package so the move file is done in a script task using system.io. Deploy that and it works with the same proxy account on the job, so it's not a permissions issue.
I'm happy it works, but want to know why it failed before.
The error I got when it failed was, "File or Directory "\destinationpath" represented by connection "archiveconnectioname" does not exist."
Has anyone any ideas?

where to set the package password property

I have an SSIS package with protection level - EncryptSensitiveWithPassword and I can execute this package with in the BIDS.
While trying to deploy to file system using the Package Deployment Wizard I receive the error
The protection level of the package requires a password but the
package password property is empty
Where should I set this password? (In BIDS in the designer I have set this password and while trying to open the project it even asks me for the password) So for deployment is there a another property to set?
This error is generally caused due to the property PackagePassword being empty in your configuration. Kindly check it and if it's not set, set it.
Also change the protection level to DontSaveSensitive after opening the package using the password. Then add the packages to your solution and once you are done, make the protection level as SaveSensitiveWithPassword.
Try deploying your package with these settings.
Reference:Securing your SSIS Packages
As per the answer by user2339071, if you don't have any passwords in your connections (i.e. you use windows trusted security) then you don't actually need a password.
But, assuming you do... (perhaps you could calrify in the original question):
My understanding is that the package password is basically specified at runtime, not deployment time.
When your DTSX file exists in the file system (after deploying it or copying it there directly), then you need to execute it somehow and that's where you specify the package password.
For example if you use SQL Agent to run your package you will find a field in the job to enter that package password. If you use DTEXEC.EXE directly, there is a switch in there for your package password also.
Personally I don't use the package deployment wizard, I just copy the DTSX file to the target file location.
Set or change the protection level of the package or packages by using a command similar to the one of the following examples:
The following command sets the ProtectionLevel property of an individual package in the file system to level 2, "Encrypt sensitive with password", with the password, "strongpassword":
dtutil.exe /file "C:\Package.dtsx" /encrypt file;"C:\Package.dtsx";2;strongpassword
The following command sets the ProtectionLevel property of all packages in a particular folder in the file system to level 2, "Encrypt sensitive with password", with the password, "strongpassword":
for %f in (*.dtsx) do dtutil.exe /file %f /encrypt file;%f;2;strongpassword
If you use a similar command in a batch file, enter the file placeholder, "%f", as "%%f" in the batch file.
You can also easily set the package password by going into the 'Package Explorer' then right click on the package to go into the properties and set your protection level there.

Execute package task asking password if I saved the package with "Encrypt All with password"

I Have a Package which will execute 7 packages using execute package task. Those 7 packages are saved with protection level as "Encrypt all data with password".
While configuring Execute Package task I selected the Location as "File System". Daily I need to run this package manually. But the Problem is I need to give password for all the 7 packages every time I want to execute it. Usually I run this package during lunch time.
Is there anyway I can store the package password programmatically? If I ran it yesterday and I didn't close the BIDS and I'm running it again today this will not ask for the password.
I also tried to build the package after the first run where it didn't ask for the password. Then I run it again without closing the BIDS. But this is still not working.
Even if you store the package passwords SSIS will always prompt you for entering the password when you are using BIDS to execute it . This is because BIDS try to open the individual child package designer and hence prompts you for entering the password .
So the only way is to execute it without the dialogue prompt for password is to use sql agent or dtexec utility
1.In order to execute the child packages i suggest you to create a config file for the parent package and select the property Package Password for all your Execute Package Task
2.Now in the config file enter the password for all the individual execute package task
<Configuration ConfiguredType="Property" Path="\Package\Execute Package Task.Properties[PackagePassword]" ValueType="String">
<ConfiguredValue>Password</ConfiguredValue>
</Configuration>
3.Execute your package using dtexec utility
dtexec.exe /f "PackageLocation/Parent.dtsx"

Unzip a Password Protected file in SSIS

I have problem with Unzipping a Password Protected file in a SSIS Package.
I Always use Execute Process task But this time After the package download zip file from ftp it must unzip it then i use it as flat file.
now the problem is i can't unzip the file cause its password protected.i have the password of file but i don't now how to use it.
is there a command line or some thing?
You need to find a command-line tool that can unzip password protected zip files, then you can use the Execute Process task as usual. If you don't want to hard-code the password into the SSIS package, you could put it in a package variable, populate the variable from a package configuration or a dtexec parameter, and then set the properties of the Execute Process task dynamically.
Finally find it...
use a execute process task and set parameter as below:
executable : C:\Program Files\WinRAR\WinRAR.exe.....(winrar location)
Arguments : e -o+ -ppassword "filename"........i.e e -o+ -p12345 "D:\TRFolder\TR0426.zip"
Working Directory : D:\TRFolder ....... UnzipPath
peace
I got it which actually worked for me.
We need to pass some parameter in the Execute Process task Editor
executable: C:\Program Files\7-Zip\7z.exe [ Source where 7z is installed file]
Arguments: here we have to pass source, password (if any) & destination. followed by e(i.e extract)
For example:
e "D:\App\File\TextDoc.7z" -p1234#Abcd -oD:\App\File\Extract * -r
Here
e means extract
Source: D:\App\File\TextDoc.7z
password: 1234#Abcd
Destination: D:\App\File\Extract
r: this is for Read. means the extracted file file will be visible while extracting

SSIS package not running when called as step in SQL Job

I have a .dtsx file (an SSIS package) that downloads files from an FTP server and imports data. It runs fine whenever I run it manually. However, when I schedule calling the package as a step in a SQL server agent job, it fails. The step it fails at is the one where I call a .bat file. The error in the job history viewer says this:
Error: 2009-05-26 12:52:25.64
Code: 0xC0029151 Source: Execute
batch file Execute Process Task
Description: In Executing
"D:\xxx\import.bat" "" at "", The
process exit code was "1" while the
expected was "0". End Error DTExec:
The package execution returned
DTSER_FAILURE (1).
I think it's a permissions issue, but I'm not sure how to resolve this. The job owner is an admin user, so I've verified they have permissions to the directory where the .bat file is located. I've tried going into Services and changing the "Log On As" option for SQL Server Agent, and neither option works (Local System Account and This Account). Does anyone have ideas as to what other permissions need to be adjusted in order to get this to work?
I tried executing just the batch file as a SQL Job step, and it gave more specifics. It showed that it failed when I was trying to call an executable, which was in the same directory as my .bat file, but not in the windows/system32 directory, which is where it was executing from.
I moved the executable to the system32 directory, but then I had no clue where my files were being downloaded to. Then I found that there's a property for the Execute Process Task (the one that executes the .bat) called WorkingDirectory. I set this to be the directory where the bat is located, moved the executable back into the same one as the .bat file, and it's now working as expected.
For me it was a permissions issue. Go to Environment --> Directories, then change Local directory to something the SQLAgentUser can access. I used C:\temp. Click the dropdown for Save, and choose "Set defaults".
Are you executing the SSIS job in the batch file, or is the batch file a step in the SSIS control flow?
I'm assuming the latter for this answer. What task are you using to execute the batch file (e.g. simple execute program task or a script task). If the latter, it looks like your batch file is actually failing on some step, not the SSIS script. I'd check the permissions of what your batch file is trying to access
In fact, it might be a better idea to rewrite the batch file as a script task in SSIS, because you'll get much better error reporting (it'll tell you which step in the script fails).
You could try executing the batch file using the runas command in a command window. If you try and execute it under the local system or network system account, it should give you a better error. If it does error, you can check the error level by going "echo %ERRORLEVEL%".
If it wasn't the latter, and you're executing the SSIS package via a batch file, why?
Are you possibly accessing a mapped drive in your .bat file? If so, you can't rely on the mapped drive from within the service, so you'd have to use UNC path.
I had the same error and I resolved it by logging on to the user account that runs the job, opened Coreftp site in question there, test the site access, made the change there (in my case, I had to reenter the new password) and now it works.
So yes, it is an issue of file access. This one is file access to the coreftp site in question.