Script to create user account?
Script to create user account?
Hi there,
I newby.
I using Windows 2003 server, IIS6, PHP 5.0.3, hMailServer 4.0-B125 and SM for hMailServer Mod 0.1.
It's there any scripts to auto-create user accounts? So that I not need to create account one-by-one.
Thanks.
I newby.
I using Windows 2003 server, IIS6, PHP 5.0.3, hMailServer 4.0-B125 and SM for hMailServer Mod 0.1.
It's there any scripts to auto-create user accounts? So that I not need to create account one-by-one.
Thanks.
Regards,
Chai Kam Weng
Chai Kam Weng
Hi Martin,
Thanks for quick reply.
Something like the script read from database (MSSQL or MYSQL) contain the username, user personal information, default password, etc and create the account.
Cause this project mainly for students to use - about 200 users. I can't create one-by-one.
Any sample or referenece?
Thanks.
Thanks for quick reply.
Something like the script read from database (MSSQL or MYSQL) contain the username, user personal information, default password, etc and create the account.
Cause this project mainly for students to use - about 200 users. I can't create one-by-one.

Any sample or referenece?

Thanks.
Regards,
Chai Kam Weng
Chai Kam Weng
There currently are such a tool. Do you have the student list in a database or in a text file or so? If you have them in a text file, you can use TextFileMigrate.exe to import the users. But that only imports username/password/accountsize and needs to be formatted properly. Let me know if you want instructions for this..
-
- Normal user
- Posts: 40
- Joined: 2005-07-21 01:52
- Location: North Little Rock, AR / Novato, CA
- Contact:
I just used textmigrate--worked as flawlessly as I expected.
If it's simple, I'd like a version that creates aliases... maybe so i could say:
user,password,quota,alias
because mine is one of those companies where everyone's real email address is some id number, i.e. 13241235@dmrevolution.com, and then everyone gets one or more aliases to represent their public address, i.e. jsmith@dmrevolution.com or john.smith@dmrevolution.com.
If it's simple, I'd like a version that creates aliases... maybe so i could say:
user,password,quota,alias
because mine is one of those companies where everyone's real email address is some id number, i.e. 13241235@dmrevolution.com, and then everyone gets one or more aliases to represent their public address, i.e. jsmith@dmrevolution.com or john.smith@dmrevolution.com.
-
- Normal user
- Posts: 40
- Joined: 2005-07-21 01:52
- Location: North Little Rock, AR / Novato, CA
- Contact:
This folder has said files... Click here.
I'm thinking my earlier request, to have an option for creating aliases in like manner would be easier handled by a separate alias application, that would just use a file like:
alias,user
While we're at it, is there a reason the ability to import CSVs is not just made an integral part of the administration program?
Anyway, martin probably wants someone else to take the lead with something like that. I'd do all I can, but I don't have any VB skills... Who's got those skills and is willing to volunteer to be a contributing member of society?
I'm thinking my earlier request, to have an option for creating aliases in like manner would be easier handled by a separate alias application, that would just use a file like:
alias,user
While we're at it, is there a reason the ability to import CSVs is not just made an integral part of the administration program?
Anyway, martin probably wants someone else to take the lead with something like that. I'd do all I can, but I don't have any VB skills... Who's got those skills and is willing to volunteer to be a contributing member of society?
-
- New user
- Posts: 4
- Joined: 2005-06-23 20:46
Add Users Script
Here is the code I created for adding a user to hMailServer. It is written in vbscript:
This also requires a CSV file called Users.csv in the same directory as the script. The CSV is in the following format:
Simply add all of your users to the CSV, run the script and away it goes!
Jason
Code: Select all
Option Explicit
Dim obBaseApp
Dim objFSO
Dim objTextFile
Dim strNewUser,i
Const ForReading = 1
Set obBaseApp = CreateObject("hMailServer.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("Users.csv", ForReading)
Do While objTextFile.AtEndOfStream <> True
strNewUser = split(objTextFile.Readline, ",")
AddUser strNewUser(0), strNewUser(1), strNewUser(2)
i = i + 1
Loop
Sub AddUser(strUsername, strPassword, strDomain)
Dim obDomain
Dim obAccounts
Dim obNewAccount
Set obDomain = obBaseApp.Domains.ItemByName(strDomain)
Set obAccounts = obDomain.Accounts
Set obNewAccount = obAccounts.Add()
obNewAccount.Address = strUsername & "@" & strDomain 'username
obNewAccount.Password = strPassword 'password
obNewAccount.Active = 1 'activates user
obNewAccount.Maxsize = 0 'sets mailbox size, 0=unlimited
obNewAccount.Save() 'saves account
Set obNewAccount = Nothing
Set obDomain = Nothing
Set obAccounts = Nothing
End Sub
Code: Select all
username,password,domain
Jason
-
- Senior user
- Posts: 886
- Joined: 2005-11-28 11:43
To run the script, run:
Code: Select all
WScript ScriptName.vbs
-
- Senior user
- Posts: 886
- Joined: 2005-11-28 11:43
Re: Script to create user account?
These scripts are a few years old now. Is there a newer or better way to import users now?
The script gives me errors about authentication - is there a later version now?
The script gives me errors about authentication - is there a later version now?
-
- New user
- Posts: 2
- Joined: 2007-10-06 04:22
- Location: NE Ohio
- Contact:
Re: Script to create user account?
i'm also looking for an item like this...please let me know as well.
Re: Script to create user account?
I know this is an old topic but does anyone have the files? I'm looking to add around 2K+ accounts to a new hMailServer and could really use the migration program.
Re: Script to create user account?
Did you read the topic? There's a script just a few posts before yours with a script to import from text file.
Apart from that, the migration tool is located here:
http://download.hmailserver.com/utiliti ... igrate.zip
Apart from that, the migration tool is located here:
http://download.hmailserver.com/utiliti ... igrate.zip
Re: Script to create user account?
Yes, I did read the topic. I see the script. But the link for the migration tool was not working. I was looking for the tool.
Thanks for updating the link.
Thanks for updating the link.
Re: Script to create user account?
I know the text file has to be in the same folder as the exe. What is the best folder to run the whole operation in?
Re: Script to create user account?
Martin or anyone else? -> Best way to run this? <-
Re: Script to create user account?
Hows about make a backup of your hMail Dir then just try it 

If at first you don't succeed, bomb disposal probably isn't for you! ヅ
Re: Script to create user account?
Very funny, but with a large list (2000+), I'd like the best practice first! 

Re: Script to create user account?
It's a 3-step (or something close to that) wizard where you specify the text file location and domain to import into the accounts into. It's kind of hard to add any best practice information to that except for what ^DooM^ has already said...
You may want to inform your users that you're doing maintenance on the server. Shouldn't affect them but anyway.

Re: Script to create user account?
hey guys
can anyone please tell me how can create the accounts using java???
please reply..
can anyone please tell me how can create the accounts using java???
please reply..
Re: Script to create user account?
There is a VBS script about 10 posts up.
You could use it, or even use it as a starting point.
You may want to check the latest COM API documentation as the COM API has changed significantly from ver 4 to ver 5...
http://www.hmailserver.com/documentatio ... om_objects
You could use it, or even use it as a starting point.
You may want to check the latest COM API documentation as the COM API has changed significantly from ver 4 to ver 5...
http://www.hmailserver.com/documentatio ... om_objects
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation
https://www.hmailserver.com/documentation
Re: Script to create user account?
Thanx mattg, but I don't understand VBScript so I can't convert it to java... so please please give me a way to do it through java....
Re: Script to create user account?
pranjut,
Is it even possible to access Microsoft COM with Java?
Is it even possible to access Microsoft COM with Java?
Re: Script to create user account?
I've no idea.......
Re: Script to create user account?
is it possible that, account can be created using telnet in hmail?? if yes how, if no that's also ok...
Re: Script to create user account?
hMailServers API is based on COM. If you cannot access COM from Java, you cannot access the hMailServer API. I would suggest that you read the documentation for the language you've chosen.
And no, it's not possible to telnet to hMailServer to create accounts.
And no, it's not possible to telnet to hMailServer to create accounts.
Re: Script to create user account?
thanks martin...... 

-
- New user
- Posts: 1
- Joined: 2014-09-03 08:23
Re: Script to create user account?
update the script
Code: Select all
Option Explicit
Dim obBaseApp
Dim objFSO
Dim objTextFile
Dim strNewUser,i
Const ForReading = 1
Set obBaseApp = CreateObject("hMailServer.Application")
Call obBaseApp.Authenticate("Administrator","admin password")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("user.csv", ForReading)
Do While objTextFile.AtEndOfStream <> True
strNewUser = split(objTextFile.Readline, ",")
AddUser strNewUser(0), strNewUser(1), strNewUser(2)
i = i + 1
Loop
Sub AddUser(strUsername, strPassword, strDomain)
Dim obDomain
Dim obNewAccount
'WScript.Echo obBaseApp.Domains
Set obDomain = obBaseApp.Domains.ItemByName(strDomain)
Set obNewAccount = obDomain.Accounts.Add()
obNewAccount.Address = strUsername & "@" & strDomain 'username
obNewAccount.Password = strPassword 'password
obNewAccount.Active = 1 'activates user
obNewAccount.Maxsize = 1024 'sets mailbox size, 0=unlimited
obNewAccount.Save() 'saves account
Set obNewAccount = Nothing
Set obDomain = Nothing
End Sub