SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Running pscp.exe in script task
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

infodemers
Posting Yak Master

Canada
166 Posts

Posted - 08/24/2012 :  11:19:57  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

United Kingdom
1769 Posts

Posted - 08/25/2012 :  03:25:38  Show Profile  Visit jackv's Homepage  Reply with Quote
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

Canada
166 Posts

Posted - 08/27/2012 :  10:06:35  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

United Kingdom
1769 Posts

Posted - 08/28/2012 :  03:19:57  Show Profile  Visit jackv's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000