LF

#27 TOP TIP 

for Globalscape EFT Server

EFT comes with a complete set of API calls, which allow you to get more out of EFT than by simply using the Admin Console.

APIs can be used for every feature of the software and called as a part of the script. That might be to enable scripting of some basic admin functions such as user creation, or more complicated activities such as creating file structures and shared folders.

API calls can also be used to get information out of the system. Some examples include:

  • The number of Workspaces licences in use by a specific group of users.
  • A list of all users, when they logged in and even if their password has expired.

All this information is available through the console app but cannot be compiled in a simple list.

Getting started

Before you can start to use the API script you will need the COM API installed onto the machine where the script will be executed.
The easiest way to do this is to install the EFT console onto that machine (from the EFT installer that you used to install your main server).

Finally, you will need to enable COM access for an Admin user (managed through the EFT console via the Administration tab of the server).

 

Scripts

Once you have the user and connections configured to accept API calls, you can start scripting using VB Scripting, PowerShell or similar.

Although the syntax of commands may alter between scripting languages, every script needs to declare connection information via a COM object. For example, a typical opening section of a VB Script may include the following lines:

Set SFTPServer = WScript.CreateObject(“SFTPCOMInterface.CIServer”)

CRLF = (Chr(13)& Chr(10))

txtServer = “localhost”

txtPort = “1111”

txtAdminUserName = “API”

txtPassword = “A1bC3d$E5”

<- Put your Server name or IP here

<- Put your Admin port here

<- This is the user name

<- This is the user password

The command to connect to the EFT server would then be:

Connect(txtServer, txtPort, txtAdminUserName, txtPassword)

After this the body of your script can either retrieve settings or set them as required. For example, the following script snippet retrieves the number of Workspaces seats used and available.

Seatsleft = SFTPServer.WSSeatsMax – SFTPServer.WSSeatsUsed

Set objFSO=CreateObject(“Scripting.FileSystemObject”)

Set objFile = objFSO.CreateTextFile(outFile,True)
objFile.Write “There are a maximum of ” & SFTPServer.WSSeatsMax & ” seats available.” & vbCrLf
objFile.Write “There are ” & SFTPServer.WSSeatsUsed & ” seats in use” & vbCrLf
objFile.Write “That leaves ” & Seatsleft & ” seats unused” & vbCrLf
objFile.Close

This will output a string to a file which would look similar to this.

There are a maximum of 25 seats available

There are 8 seats in use

That leaves 17 seats unused

Automating the script

If you use a VBScript to make your API calls, you would need to have a custom command to call cScript.exe and pass it the VBScript name.

If you are using Powershell then you would create a custom command to call powershell.exe

Our definition of the cScript command in our EFT looks like this and allows a filename to be passed to the script as well.

 

Once this is built you can automate the VBScript by calling it in an event rule, for example:

 

In our Event rule, the output file is emailed to a user as an attachment.

Need help or short of time?

Do you need help constructing scripts to make use of the APIs? Or are you short on time and would prefer to outsource the job? Our EFT experts can write the scripts for your specific requirements. Request more details using the form at the bottom of the EFT Professional Services page or call 0333 123 1240. Existing Pro2col customers can email their account manager.

More information