Created
March 16, 2017 16:22
-
-
Save tdmitch/b35be8f86f5efee939740d225cce8686 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This try/catch block will capture catastrophic failures (such as specifying the wrong path to winscp). | |
try | |
{ | |
winscp.Start(); | |
winscp.StandardInput.WriteLine(sessionOptionString); | |
winscp.StandardInput.WriteLine(connectString); | |
winscp.StandardInput.WriteLine(getString); | |
winscp.StandardInput.Close(); | |
// Set the outStr to the output value, obfuscating the password | |
outStr = winscp.StandardOutput.ReadToEnd().Replace(":" + Dts.Variables["$Package::pServerUserPassword"].GetSensitiveValue().ToString() + "@", ":*******@"); | |
// Wait for the application to exit | |
winscp.WaitForExit(); | |
returnVal = winscp.ExitCode; | |
} | |
catch (Exception ex) | |
{ | |
errStr = "An error occurred when attempting to execute winscp.com: " + ex.Message.Replace("'", "\"").Replace("--", " - "); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment