Prev: Window 7 Active Directory and VbsEdit
Next: Attempting to schtask for defrag on remote XP computers in domain
From: Jason on 14 Apr 2010 10:17 Did you have to do anything with public/private keys? tooMuchCod wrote: Re: Upload to an sftp server using vbscript 09-May-07 "Justin Piper" wrote: Thanks Justin, I checked out Putty and actually ended up using it, but for others sack I ended up using it a little different. I ended up using pscp. There is more information at: http://www.tartarus.org/~simon/puttydoc/Chapter5.html. To maybe help someone save some time I actually used the command in a bat file like this: C:\Temp\pscp -2 -batch -pw myPassword c:\Temp\*.txt userName(a)sftp.yourServer.com:"/path/on/server" C:\Temp\pscp - According to the preceding website you need to put in a path statement but if you hardcode the path to pscp you don't need it. -2 (forces SSH connection.) -batch (allows me to push more than one file at a time) -pw myPassword (obviously allows me to specify the password) C:\Temp\*.txt (grabs all text files in that directory) userName(a)sftp.yourServer.com:"/path/on/server" (This one is pretty self explanatory) The part after the >> simply creates a log file in the C:\Temp\Logs directory. It will not create the directory structure but it will create a text file using todays date. Thanks again Justin, you really helped me out! Best Regards, tooMuchCode Previous Posts In This Thread: On Monday, May 07, 2007 8:53 PM tooMuchCod wrote: Upload to an sftp server using vbscript Hello All, I am going to try this again. I apparently posted this in the wrong group before and was 'politely' told to post it here. This question isn't simple and I have noticed often people ask for more information so I will give you the whole story upfront: I recently started a new job and in the past they have solved a lot of simple tasks by utilizing vbs files. I am pretty fluent in Visual Basic but a little new to vbs files so this has been an 'interesting' transition as it is. Currently I have a vbs file that runs a rather elaborate query against an SQL server, the data is exported to a csv file and then emailed to a client. This vbs file actually works really well, however the client has requested that we start uploading it to an sftp site instead. Instead of reinventing the wheel I assumed that I could replace a few email lines of code with a few ftp commands. I researched the web and found several examples utilizing ftp.exe. Through further research I found that ftp.exe offers no support for a port higher than 21. Therefore I assume that ftp.exe offers no support for sftp. Can anyone offer me a solution that will allow me to upload to an sftp server without rewriting this code in some other format! Thanks, tooMuchCode On Tuesday, May 08, 2007 7:24 AM Paul wrote: Re: Upload to an sftp server using vbscript "tooMuchCode" <tooMuchCode(a)discussions.microsoft.com> wrote in message news:91286970-45D1-40DB-94B2-C72044A25D08(a)microsoft.com... This is just typical. I've been subscribed to both groups for months now and the one you first posted on gets almost no traffic whatsoever, but of course you immediatly got a reply on there. Now you have posted on here nobody can help you so far, and sorry but I can't either, but my advice was still accurate. Paul On Tuesday, May 08, 2007 9:01 AM Anthony Jones wrote: Re: Upload to an sftp server using vbscript group as an requested that what groups are your refering to and what is your advice? On Tuesday, May 08, 2007 4:40 PM Justin Piper wrote: Re: Upload to an sftp server using vbscript On Mon, 07 May 2007 19:53:46 -0500, tooMuchCode <tooMuchCode(a)discussions.microsoft.com> wrote: PuTTY includes an SFTP client. The commands are largely the same as those for ftp.exe, so you may find you can adapt one of the examples you found to drive it instead. The program is called "psftp.exe", and can be downloaded either by itself or as part of the full distribution from this page: http://www.chiark.greenend.org.uk/~sgtatham/putty/ -- Justin Piper Bizco Technologies http://www.bizco.com/ On Wednesday, May 09, 2007 9:54 AM tooMuchCod wrote: Re: Upload to an sftp server using vbscript "Justin Piper" wrote: Thanks Justin, I checked out Putty and actually ended up using it, but for others sack I ended up using it a little different. I ended up using pscp. There is more information at: http://www.tartarus.org/~simon/puttydoc/Chapter5.html. To maybe help someone save some time I actually used the command in a bat file like this: C:\Temp\pscp -2 -batch -pw myPassword c:\Temp\*.txt userName(a)sftp.yourServer.com:"/path/on/server" C:\Temp\pscp - According to the preceding website you need to put in a path statement but if you hardcode the path to pscp you don't need it. -2 (forces SSH connection.) -batch (allows me to push more than one file at a time) -pw myPassword (obviously allows me to specify the password) C:\Temp\*.txt (grabs all text files in that directory) userName(a)sftp.yourServer.com:"/path/on/server" (This one is pretty self explanatory) The part after the >> simply creates a log file in the C:\Temp\Logs directory. It will not create the directory structure but it will create a text file using todays date. Thanks again Justin, you really helped me out! Best Regards, tooMuchCode Submitted via EggHeadCafe - Software Developer Portal of Choice WPF Datagrid as ComboBox Dropdown Part 2 http://www.eggheadcafe.com/tutorials/aspnet/5af72df7-5b0b-4ac2-be96-e24127040bbf/wpf-datagrid-as-combobox.aspx |