Sometimes there is a need to import users though a CSV file. This can be done using a combination of PowerShell and the srxCFG utility.
Lets assume we have a CSV file, users.csv, which looks like this:
Username,FullName,EmailAddress
user1,User Number 1,user1@southrivertech.com
user2,User 2,user2@southrivertech.com
user3,User 3,user3@southrivertech.com
Create a PowerShell script, ImportUsersCsv.ps1 containing the following: (note that your Admin password and Server will be different:
$users = import-csv users.csv
ForEach ($user in $users) {
$username = $($user.Username)
$fullname = $($user.FullName)
$email = $($user.EmailAddress)
.\srxCfg.exe /AdminUser=Administrator /AdminPass=test /Server=SftpServer /Cmd=AddUser /User=$username /FullName=$fullname /EmailAddress=$email
}
This PS script will pull in the users.csv file into an array, $users. Next a loop is performed to pull the Username, Fullname and Email address members from each array item and then feeds those items into the srxCfg.exe utility in the \Program Files\South River Technologies\Titan FTP Server\ folder.
Execute the PS script and the users will be imported in to the system.