Post new topic Reply to topic  [ 40 posts ] 
Author Message
 Post subject: Script to create user account?
PostPosted: 2005-07-21 02:57 
Normal user

Joined: 2005-07-18 10:14
Posts: 37
Location: Selangor, Malaysia
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.

_________________
Regards,
Chai Kam Weng


Top
 Profile  
 
 Post subject:
PostPosted: 2005-07-21 08:50 
Developer

Joined: 2003-11-21 01:09
Posts: 6395
Location: Sweden
That depends on how you want to create them. I assume you don't want a script that just creates random accounts? :)


Top
 Profile  
 
 Post subject:
PostPosted: 2005-07-21 10:43 
Normal user

Joined: 2005-07-18 10:14
Posts: 37
Location: Selangor, Malaysia
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. :shock:

Any sample or referenece? :wink:

Thanks.

_________________
Regards,
Chai Kam Weng


Top
 Profile  
 
 Post subject:
PostPosted: 2005-07-21 18:35 
Developer

Joined: 2003-11-21 01:09
Posts: 6395
Location: Sweden
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..


Top
 Profile  
 
 Post subject:
PostPosted: 2005-07-21 18:49 
Normal user

Joined: 2005-07-21 01:52
Posts: 40
Location: North Little Rock, AR / Novato, CA
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.


Top
 Profile  
 
 Post subject:
PostPosted: 2005-07-22 01:25 
Normal user

Joined: 2005-07-18 10:14
Posts: 37
Location: Selangor, Malaysia
Hi Martin & mrcolj,

Thanks for your information.

Yes, can I know where to download the TextFileMigrate.exe and how to use it (sample of the format)?

Thanks a lot :D

_________________
Regards,
Chai Kam Weng


Top
 Profile  
 
 Post subject:
PostPosted: 2005-07-22 19:51 
Normal user

Joined: 2005-07-21 01:52
Posts: 40
Location: North Little Rock, AR / Novato, CA
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?


Top
 Profile  
 
 Post subject:
PostPosted: 2005-07-23 03:16 
Normal user

Joined: 2005-07-18 10:14
Posts: 37
Location: Selangor, Malaysia
Hi Colin Jensen,

Thanks a lot :D .

Only thing is how to use it :oops: Any help file or example?

Thanks.

_________________
Regards,
Chai Kam Weng


Top
 Profile  
 
 Post subject:
PostPosted: 2005-07-23 09:11 
Developer

Joined: 2003-11-21 01:09
Posts: 6395
Location: Sweden
Download textfilemigrate4.zip and read the sample.txt

Textfilemigrate.exe allows you to select which file to import.


Top
 Profile  
 
 Post subject:
PostPosted: 2005-07-24 08:05 
Normal user

Joined: 2005-07-18 10:14
Posts: 37
Location: Selangor, Malaysia
Hi Martin,

Thanks. I will try it out. :D

_________________
Regards,
Chai Kam Weng


Top
 Profile  
 
 Post subject:
PostPosted: 2005-07-24 16:31 
New user
New user

Joined: 2004-05-07 03:32
Posts: 21
Anyway to enable it for mailenable migration?


Top
 Profile  
 
 Post subject: Add Users Script
PostPosted: 2005-09-21 17:14 
New user
New user

Joined: 2005-06-23 20:46
Posts: 4
Here is the code I created for adding a user to hMailServer. It is written in vbscript:

Code:
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


This also requires a CSV file called Users.csv in the same directory as the script. The CSV is in the following format:

Code:
username,password,domain


Simply add all of your users to the CSV, run the script and away it goes!

Jason


Top
 Profile  
 
 Post subject:
PostPosted: 2005-09-30 21:34 
Normal user

Joined: 2005-07-21 01:52
Posts: 40
Location: North Little Rock, AR / Novato, CA
thanks Jason,

in line with my above question, is there any way to add in a fourth "alias" column that would automatically create aliases for those users? Or even a second program?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: 2005-09-30 22:13 
Normal user

Joined: 2005-07-21 01:52
Posts: 40
Location: North Little Rock, AR / Novato, CA
Martin, on textfilemigrate:

If I want to add 10 new people, do I need to run the program again with a CSV of all 1000 usernames,passwords,quotas , or just the 10 new ones? Meaning if I run it right now with 10, will it delete everyone else, or just add 10?

Thanks Martin.


Top
 Profile  
 
 Post subject:
PostPosted: 2005-09-30 22:16 
Developer

Joined: 2003-11-21 01:09
Posts: 6395
Location: Sweden
The program should only do add's, not deletes. So it should be enough to give it the next 10. But I suggest you take a backup before doing it..


Top
 Profile  
 
 Post subject:
PostPosted: 2006-03-08 21:17 
New user
New user

Joined: 2006-03-08 20:53
Posts: 9
is there a reason why this would not work on windows 2000 server ?

nothing happens when i start it. :confused:


Top
 Profile  
 
 Post subject:
PostPosted: 2006-03-08 21:22 
Developer

Joined: 2003-11-21 01:09
Posts: 6395
Location: Sweden
What did you do? Did you run the program or the script?


Top
 Profile  
 
 Post subject:
PostPosted: 2006-03-08 21:41 
New user
New user

Joined: 2006-03-08 20:53
Posts: 9
created the csv, placed in the same folder and double clicked on the script.

should i run it in another way ?


Top
 Profile  
 
 Post subject:
PostPosted: 2006-03-08 21:50 
Senior user
Senior user

Joined: 2005-11-28 11:43
Posts: 886
To run the script, run:
Code:
WScript ScriptName.vbs


Top
 Profile  
 
 Post subject:
PostPosted: 2006-03-08 22:13 
New user
New user

Joined: 2006-03-08 20:53
Posts: 9
weird... still nothing hapening.

c:\script.vbs
c:\objects.csv

cmd
cd \
wscript script.vbs


nothing happens... just returning to my prompt with no eror


Top
 Profile  
 
 Post subject:
PostPosted: 2006-03-08 22:31 
Senior user
Senior user

Joined: 2005-11-28 11:43
Posts: 886
Quote:
This also requires a CSV file called Users.csv in the same directory as the script
... you don't seem to have that file.


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2008-03-26 23:29 
Normal user

Joined: 2008-02-12 23:59
Posts: 33
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?


Top
 Profile  
 
 Post subject: Re:
PostPosted: 2008-03-26 23:36 
Normal user

Joined: 2008-02-12 23:59
Posts: 33
martin wrote:
Download textfilemigrate4.zip and read the sample.txt

Textfilemigrate.exe allows you to select which file to import.


Yeah but where from. The link about wont let me browse the directory


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2008-04-01 20:59 
New user
New user

Joined: 2007-10-06 04:22
Posts: 2
Location: NE Ohio
i'm also looking for an item like this...please let me know as well.


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2008-10-16 20:37 
New user
New user

Joined: 2008-10-16 20:35
Posts: 5
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.


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2008-10-16 20:50 
Developer

Joined: 2003-11-21 01:09
Posts: 6395
Location: Sweden
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


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2008-10-16 21:00 
New user
New user

Joined: 2008-10-16 20:35
Posts: 5
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.


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2008-10-17 17:21 
New user
New user

Joined: 2008-10-16 20:35
Posts: 5
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?


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2008-10-21 15:39 
New user
New user

Joined: 2008-10-16 20:35
Posts: 5
Martin or anyone else? -> Best way to run this? <-


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2008-10-21 15:40 
Site Admin
User avatar

Joined: 2005-07-29 16:18
Posts: 13648
Location: UK
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! ヅ


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2008-10-21 16:00 
New user
New user

Joined: 2008-10-16 20:35
Posts: 5
Very funny, but with a large list (2000+), I'd like the best practice first! :mrgreen:


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2008-10-21 19:02 
Developer

Joined: 2003-11-21 01:09
Posts: 6395
Location: Sweden
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.


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2009-12-30 00:10 
New user
New user

Joined: 2009-11-16 17:41
Posts: 10
hey guys
can anyone please tell me how can create the accounts using java???
please reply..


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2009-12-30 01:34 
Moderator
User avatar

Joined: 2007-06-14 05:12
Posts: 9562
Location: 'The Outback' Australia
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

_________________
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
Documentation


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2009-12-30 22:39 
New user
New user

Joined: 2009-11-16 17:41
Posts: 10
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....


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2009-12-30 22:40 
Developer

Joined: 2003-11-21 01:09
Posts: 6395
Location: Sweden
pranjut,
Is it even possible to access Microsoft COM with Java?


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2009-12-30 22:55 
New user
New user

Joined: 2009-11-16 17:41
Posts: 10
I've no idea.......


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2009-12-30 22:58 
New user
New user

Joined: 2009-11-16 17:41
Posts: 10
is it possible that, account can be created using telnet in hmail?? if yes how, if no that's also ok...


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2009-12-30 23:04 
Developer

Joined: 2003-11-21 01:09
Posts: 6395
Location: Sweden
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.


Top
 Profile  
 
 Post subject: Re: Script to create user account?
PostPosted: 2009-12-30 23:19 
New user
New user

Joined: 2009-11-16 17:41
Posts: 10
thanks martin...... :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 40 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest



Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group