Monday, March 19, 2012

How to dynamically set the ServerPassword

I have an FTP Task where I have to set the server password at run-time. I have the ftp connection manager set up. What I normally do is configure the ftp server connection manager using a dtsConfig file but I can't do that in this case. I won't know the serverpassword until I get a parameter from the user.

That one property as you've seen can't be set through a connection expression. You could do it thorugh a script task if you wanted to do it inside the package. You could also try to set it through dtexec.exe if you're executing the package that way by using the /SET switch.

Just to elaborate on the /SET switch, here's some example syntax:

DTExec /FILE Package.dtsx /SET \Package.Connections[ConnectionID].ServerPassword;PasswordHere

Brian Knight

|||

Thanks Brian.

Yes, I do want to do it in the package because the package is being launched via dtexec from a generic web app that creates textboxes for the parameters. I would like to keep the web app generic and free of package-specific code. I created a script task and I set the password by getting the ServerPassword property from the ConnectionManager's properties collection and then using the SetValue method of the DtsProperty object.

No comments:

Post a Comment