Unable to connect using VBScript for either FTP or SFTP

This forum is not monitored by the SmartFTP staff. If you have a license please contact technical support by email.
ajayprasad
Posts: 9
Joined: Mon Jul 28, 2008 3:26 pm

Unable to connect using VBScript for either FTP or SFTP

Post by ajayprasad » Mon Jul 28, 2008 3:32 pm

Hi,
We recently purchased licenses of SmartFTP Pro here at Hoffman Enclosures Inc. Prior to purchasing the licenses, we evaluated the software by running a VBScript using SmartFTP and FTPLibrary to do SFTP/FTP. However this script does not work after we installed SmartFTP Pro. It is unable to connect to the server. We are able to connect to the server using the SmartFTP Pro client so the user name/password and server IP are all correct.

We traced the FTP Process flow, the script gets invoked, and has all the passed in arguments but the return code of obj.connect() is 17 and then the script fails indicating its unable to connect to the FTP server. This happens for both FTP and SFTP. Please help us resolve this issue as it is stopping a scheduled PRODUCTION rollout.

I even ran the sample script "Simple.vbs" and even here the return code is 17. I also emailed support@smartftp.com on 07/25/08 with a copy of the VB Script that we are using.

Thanks
Ajay
Last edited by ajayprasad on Mon Jul 28, 2008 3:37 pm, edited 1 time in total.

mb
Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Unable to connect using VBScript for either FTP or SFTP

Post by mb » Mon Jul 28, 2008 4:18 pm

Did you purchase a license for the FTP Library and did you load it with the LoadLicenseKeyData method?

Regards,
Mat

ajayprasad
Posts: 9
Joined: Mon Jul 28, 2008 3:26 pm

Re: Unable to connect using VBScript for either FTP or SFTP

Post by ajayprasad » Mon Jul 28, 2008 5:02 pm

<blockquote class="ipsBlockquote" data-author="mb" data-cid="49314" data-date="Jul 28 2008, 11:18 AM">Did you purchase a license for the FTP Library and did you load it with the LoadLicenseKeyData method?
Regards,
Mat</blockquote>Hi Mat,
Luanne who made the purchase is out of the office. I will confirm with her tomorrow. I believe we purchased 25 licenses of Smart FTP Pro because the professional version included FTP Library and that way we did not have to buy a developer license of FTP Library.
Regarding LoadLicenseKeyData method - I need a little assistance here as I am not familiar with VB Script. I pass in arguments and accordingly create a connection object either for FTP or SFTP. None of these objects support the LoadLicenseKeyData method. So I create a global object that supports the LoadLicenseKeyFile method. I got the latest license.xml file from the web and I used that with the LoadLicenseKeyFile method, however the method is returning FALSE so I have not been successful in doing that. Please advise
We have two license keys - one with 15 licenses and another with 10 licenses. So I'd prefer using the LoadLicenseKeyFile method than the LoadLicenseKeyData method so that I can maintain one version of the VBScript file.
Last edited by ajayprasad on Thu Apr 11, 2013 9:46 pm, edited 1 time in total.

mb
Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Unable to connect using VBScript for either FTP or SFTP

Post by mb » Mon Jul 28, 2008 5:06 pm

Hello ..

For what purpose are you using the FTP Library?

Regards,
Mat

ajayprasad
Posts: 9
Joined: Mon Jul 28, 2008 3:26 pm

Re: Unable to connect using VBScript for either FTP or SFTP

Post by ajayprasad » Mon Jul 28, 2008 5:12 pm

Hello ..

For what purpose are you using the FTP Library?

Regards,
Mat

Hi Mat,
We are using the FTP Library to transfer documents via SFTP/FTP silently. To do this, we created a VB Script based off the sample scripts for file upload. This script was working fine during our evaluation obviously because it was using the trial license which has since expired. We run the VBScript using cscript and pass a bunch of arguments that tell the script to do either FTP or SFTP with all login details. This way the user only sees a cmd window pop up for a couple of seconds and then close automatically rather than use a FTP client.


Thanks
Ajay

mb
Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Unable to connect using VBScript for either FTP or SFTP

Post by mb » Mon Jul 28, 2008 5:14 pm

Hello Ajay ..

How many users will be using this script?

Regards,
Mat

ajayprasad
Posts: 9
Joined: Mon Jul 28, 2008 3:26 pm

Re: Unable to connect using VBScript for either FTP or SFTP

Post by ajayprasad » Mon Jul 28, 2008 5:17 pm

Hello Ajay ..

How many users will be using this script?

Regards,
Mat

Hi Mat,
I think a maximum of 10 - 12 users will use this. Its a very limited set of users who have access to modify and upload documents to our FTP servers. The number might even be smaller, if you'd like I can get you an exact count but am sure it will not exceed what I just mentioned.

Regards
Ajay

mb
Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Unable to connect using VBScript for either FTP or SFTP

Post by mb » Mon Jul 28, 2008 5:21 pm

Hello ..

Thanks. So to use the FTP Library through the Pro version of SmartFTP you have to create the objects through the SmartFTP application object. To do this use the sample code in the SDK\Samples\Script folder. Here is the code you are probably interested in:

Code: Select all

Dim objSmartFTP

' get existing

' Reference: http://www.microsoft.com/technet/scriptcenter/guide/sas_vbs_ekqn.mspx?mfr=true

' http://www.mail-archive.com/vbscript@p2p.wrox.com/msg00127.html			

On Error Resume Next

Set objSmartFTP = GetObject(,"SmartFTP.Application")

On Error Goto 0



If TypeName(objSmartFTP) <> "Application" Then

   Set objSmartFTP = WScript.CreateObject("SmartFTP.Application")

End If



objSmartFTP.Visible = true



Dim objGlobal 

Set objGlobal = objSmartFTP.CreateObject("sfFTPLib.Global")



Dim objFTPConnection

Set objFTPConnection = objSmartFTP.CreateObject("sfFTPLib.FTPConnectionSTA")

As you can see you don't need to load the license key for the ftp library because you don't have/need one.

Regards,
Mat
Last edited by mb on Mon Jul 28, 2008 5:22 pm, edited 1 time in total.

ajayprasad
Posts: 9
Joined: Mon Jul 28, 2008 3:26 pm

Re: Unable to connect using VBScript for either FTP or SFTP

Post by ajayprasad » Mon Jul 28, 2008 7:15 pm

Hi Mat,
It worked. Thanks much!!

However I was unable to locate the sample code. I do not have a SDK folder on my machine for SmartFTP. Would it be possible to email these sample scripts to me...

Thanks
Ajay

mb
Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Unable to connect using VBScript for either FTP or SFTP

Post by mb » Mon Jul 28, 2008 7:27 pm

You can download the SDK from here:
https://www.smartftp.com/forums/SmartFTP ... 13484.html

Regards,
Mat

Post Reply