Solved

PSFTP Automation using batch file

Posted on 2009-05-06
7
2,211 Views
Last Modified: 2013-12-09
Hello,
I have been looking forever and I just cant make sense of the process to automate a process using batch files and psftp from windows 2k3 to an sftp site.
I was able to write a ssh script that opens the psft application, inputs the correct login sequence informatino and transfers the files. The only issue here is that it can only run when i am logged into the server. I need to be able to create batch files that will automate the process, but cant find too much information on the web to do this.
Any help would be greatly appreciated.

Thank You,
jsears1979
0
Comment
Question by:jsears1979
  • 3
  • 2
7 Comments
 
LVL 28

Expert Comment

by:lesouef
ID: 24322884
in theory you can use the windows schedule to trigger this with no open session. Just specify which account should be used to start the task if specific rights are required, otherwise system account rights will be used. Normally everythin whihc can be lauched from the command line with no other user interaction can be launched this way; visible from the desktop depens on task parameters, and if a session is open. Ig no session is open errors will be logged in the event viewer.
0
 

Author Comment

by:jsears1979
ID: 24329856
Here is the process that I am currently using...
Batch file is scheduled to open psfp application, change the name of the file and run the ssh script that inputs the information into the psftp prompts. The ssh script inputs the correct information, deletes the file upon successful upload and exits/closes the psftp application. Again, this works flawlessly when I run it manually by double clicking the first batch file to kick off the whole process... the problem is that when I schedule it and it tries to run when I am not logged in, it cant open the psftp application. I have full admin rights to the server, so I do not think that is the issue. It is more an issue of getting an psftp session to run when I am not logged in.

Thanks
0
 
LVL 28

Expert Comment

by:lesouef
ID: 24330217
why don't you run psftp directly? why is ssh required to input "correct information" and delete a file?
this whole thing could be a regular shell script doing the "pre" and "post" steps, and call psftp in between with the right arguments?
have you tried to change the account starting the scheduled task or not?
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

Author Comment

by:jsears1979
ID: 24338325
This is on a server and it needs to be a scheduled task to run in the evenings nightly. I cant run psftp directly unless i want to log into the server every night and open it. I use my account on the server which has complete admin priveleges. I have tried using another service account as well as1 other admin ID. The shell script would use the send keys command to type in the account and login information without a user having to do it.
0
 
LVL 28

Accepted Solution

by:
lesouef earned 500 total points
ID: 24340318
I am not with you... as far as I know psftp can take all the parameters it needs from the command line arguments; so if you make a shell script of that, the scheduler should be able to do this, there is no need for keyboard entries or sendkeys. if its prompts for question, its because you are missing arguments like -pw
0
 
LVL 8

Expert Comment

by:Rsulliv1
ID: 34941454
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Read about how to approach blogging and about ways to do it right. Stand out from the crowd and let your knowledge be consumed by a large audience. This article aims to explain how your blog should look like,  the most important things to do while b…
This article will shed light on the latest trends when it comes to your resume building needs. For far too long, the traditional CV format has monopolized the recruitment market.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question