Can I create multiple users in EFT by importing a spreadsheet?


THE INFORMATION IN THIS ARTICLE APPLIES TO:

  • EFT v6.x and later

QUESTION

Can I create multiple users in EFT by importing a spreadsheet?

ANSWER

For the best user experience and ease of management, using Active Directory/LDAP authentication will populate the Site with the Active Directory users. If you are using Globalscape authentication, you can create users one at a time or create multiple users based on the content of a properly formatted spreadsheet.

The VB script below will import the content of the spreadsheet to create users. You can add as much or as little information as you want. For example, the script below creates multiple users based on the content of column A, and each user has the initial password of "test." You should configure the Site to require the user to change the password upon initial login.

  • This script uses the ICISite interface CreateUser method. To provide more detailed information, you should use the CreateUserEx or CreateUserEx2 method.
  • Be sure that if enforcement of complex passwords is enabled that you provide a complex password in the spreadsheet. Otherwise, disable it during the importing of the users, then re-enable it after you have completed the import.
  • Edit the script values that your EFT is using. That is, the ServerAddress, ServerUsername, ServerPassword, port number for remote access, and the path\name of the spreadsheet each need to be edited for your environment.
ServerAddress = "192.168.102.28"
ServerUsername = "username"
ServerPassword = "password"
ExcelFile = "C:\wd\Users.xlsx"
siteName = "GS"
Set SFTPServer = CreateObject("SFTPCOMInterface.CIServer")
SFTPServer.Connect ServerAddress,1100,ServerUsername,ServerPassword
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(ExcelFile)
objExcel.Visible = True
i = 1
Do Until objExcel.Cells(i, 1).Value = ""
password = selectedSite.CreateComplexPassword()
selectedSite.CreateUser objExcel.Cells(i, 1).Value, password, 0, "Script Created User " & FormatDateTime(Now, vbLongTime)
i = i + 1
Loop
objExcel.Quit

MORE INFORMATION

Regarding the spreadsheet formatting:

Each column is a data set, read from top to bottom. The script starts in column A, row 1, and works its way down until it encounters an empty cell. If you want to add other information (e.g., user emails or passwords), add it to the other columns and edit the script to pull that data.

For finer control, you can use the CreateUserEx method as described in the API Reference. This is useful if, for example, you are importing from a *nix password file and want to push that data into EFT. The thing to note is objExcel.Cells coordinates are (Row, Column), so (5, 1) = A5 in Excel.

Regarding the VB Script:

"i=1" preceding the Do loop tells the script to start in cell A:1. If your spreadsheet has a header row and the data actually starts on row 2, change this "i=1" to "i=2".