Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Running pscp.exe in script task

Author  Topic 

infodemers
Posting Yak Master

183 Posts

Posted - 2012-08-24 : 11:19:57
I am trying to run pscp.exe from my vb script task and run it from an SQL job but it looks like there is a security warning waiting for a click on the server side. Anyone running pscp.exe from script task with success?


With myProcess
.StartInfo.UseShellExecute = True
.StartInfo.Arguments = "\\BLMCIK\CMAMS\pscp.exe -l report -pw report " & RawData(i).ToString & " " & TreatedData(i).ToString
.StartInfo.FileName = ArgumentLine
.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
.Start()
.WaitForExit()
End With

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2012-08-25 : 03:25:38
Check this link - an example from Powershell - but same idea.
I don't have a problem running it . What security warning are you getting ?

http://www.dba-db2.com/2012/08/db2-how-to-pscp-from-the-command-line.html

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page

infodemers
Posting Yak Master

183 Posts

Posted - 2012-08-27 : 10:06:35
I got it now a different way. Reference this link --> [url=http://www.groupsrv.com/computers/about664056.html][/url]

Yes I did get this resolved. It is kind of an ugly work around. The error is because I am getting prompted the first time I run SFTP from that MSSQL account, so Ihave to force in a "y" response.

To do this I created a text file named "yes.txt" and inside of it i typed the word "yes".

Then in my batch script I reference it to answer the prompt like so:

pscp -l 23 192.168.1.251 -l myUserRed -pw mypasswordRed 192.168.226.27:/home/report/usage2.20120826 \\BLMCIK\k$\RawData\CMAMS\Daily\usage2.20120826 < \\BLMCIK\k$\RawData\CMAMS\yes.txt
exit
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2012-08-28 : 03:19:57
The prompt is a good idea , as you'd lose the cached response on the reboot.


Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
   

- Advertisement -