
The VB Script below connects to the server, retrieves a list of users and publishes them to an Excel file. To try it, save the script below with a .vbs extension and then run it from the command line. Be sure to first edit the "txt" values based on your server's settings. txtServer is your server's IP address; txtPort is your server' listening port ; txtUserName and txtPassword are the administrator's username/password pair.
'
' FILE: CreateUserListSpreadSheet
' CREATED: 13 OCT 2004 GTH
' PURPOSE: List the users of a site and create an excel spreadsheet.
'
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "192.168.134.142"
txtPort = "1100"
txtUserName = "admin"
txtPassword = "admin"
' On Error Resume Next
SFTPServer.Connect txtServer, txtPort, txtUserName, txtPassword
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & txtServer & ":" & txtPort & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Quite(255)
Else
WScript.Echo "Connected to " & txtServer
End If
set Sites=SFTPServer.Sites
Set oExcel = WScript.CreateObject("Excel.Application")
oExcel.visible = true
Set oWorkbook = oExcel.Workbooks.Add
For i = 0 to SFTPServer.Sites.Count-1
set theSite=Sites.Item(i)
Set theSheet = oWorkbook.Worksheets.add
theSheet.name = theSite.Name
theSheet.Cells(1, 1) = "Users:"
arUsers = theSite.GetUsers()
For j = LBound(arUsers) to UBound(arUsers)
theSheet.Cells((j+2), 1) = arUsers(j)
Next
theSheet.Columns("A:A").EntireColumn.Autofit
Next
Set oExcel = nothing
SFTPServer.Close
Set theSite = nothing
Set SFTPServer = nothing