Bulk User creation Script?

Has anyone here already created a script for entering in bulk users from a speadsheet or db?

Cheers
Phil

Found this Redirecting to Google Groups
Will update on how I go :slight_smile:

Ok well the above wasn’t much help, but I managed to Frankenstein some existing code I’ve used in the past while looking at the editCLIENTUDUser.cfm for inspiration.
The below function only requires a struct containing {firstname,lastname,username,password}

function createUser(struct stNewUser){
    var oUser = createobject("component","#application.packagepath#.types.farUser");
    var oProfile = createobject("component","#application.packagepath#.types.dmProfile");
    var stUser = {};
    var stProfile = {};
// create struct for farUser
stUser.locked = 0;
stUser.lockedBy = '';stUser.objectID = createUUID();
stUser.datetimeCreated = now();
stUser.lastUpdatedBy = 'farcry_CLIENTUD';
stUser.datetimeLastUpdated = now();
stUser.createdBy = 'farcry_CLIENTUD';
stUser.ownedby = ''; 
stUser.typeName = 'farUser';    	
stUser.userid = stNewUser.username;
stUser.password = stNewUser.password;
stUser.userstatus = "active";
stUser.aGroups = ['E689D131-A4A0-21F0-45AB44EC3AB144CD'];// Member objectid in my table

oUser.setData(stProperties=stUser,user='admin');
// get the newly created user so we can attach a profile to it
stUser = oUser.getData(objectid=stUser.objectID);

// create struct for dmProfile
stProfile.locked = 0;
stProfile.lockedBy = '';

stProfile.objectID = createUUID();
stProfile.datetimeCreated = now();
stProfile.lastUpdatedBy = 'farcry_CLIENTUD';
stProfile.datetimeLastUpdated = now();
stProfile.createdBy = 'farcry_CLIENTUD';
stProfile.ownedby = '';

stProfile.typeName = 'dmProfile';
stProfile.firstname = stNewUser.firstname;
stProfile.lastname = stNewUser.lastname;
stProfile.label = stProfile.firstname & ' ' & stProfile.lastname;
stProfile.BRECEIVEEMAIL = 0;
stProfile.username = "#stUser.userid#_CLIENTUD";
stProfile.userdirectory = "CLIENTUD";

oProfile.setData(stProperties=stProfile,user='admin');

}// end function
1 Like