'On error Resume Next db_user = "dbuser" '##User to Login to your database.## db_pass = "dbpassword" '##Password to Login to your database.## db_server = "192.168.0.10" '##Hostname or IP Address of your SQL2005/2008 Database server.## db = "mydomainDB" '##Name of the database which hold the table you want to query.## db_schema = "dbo." '##The schema name, default=dbo. (end with a dot!).## db_table = "tbl_domains" '##The name of the table which hold your domain names.## db_domain_field = "domain_name" '##Column name. (contents of the records should be: "mydomain.com" or "yourdomain.net", so the domain name including the TLD.## str_mdaemon_path= "E:\MDaemon\" '##Path to the MDaemon directory! (If MDaemon is not installed on this computer, create the path manually!) It is used to add the \MDaemon\Domains\xxx directories.## temp_domain_file= "E:\domains.txt" '##Path of the file which content you want to add to the \MDaemon\App\Domains.dat file.## '###MAKE DB CONNECTION.### set dbconnection = CreateObject("ADODB.Connection") dbconnection.Open "Provider=SQLOLEDB;User ID="&db_user&";Password="&db_pass&";Persist Security Info=False;Data Source="&db_server&",1433;Initial Catalog="&db&";Network Library=DBMSSOCN;" '###CREATE OBJECTS.### Set rs_db = CreateObject("ADODB.Recordset") Set obj_shell = WScript.CreateObject("WScript.Shell") Set filesys = CreateObject("Scripting.FileSystemObject") set TXTdomains = filesys.CreateTextFile(temp_domain_file,true) Wscript.Echo "Add the domains!" sqlselect = "SELECT "&db_domain_field&" AS this_domain_name FROM "&db&"."&db_schema&db_table rs_db.open sqlselect, dbconnection, 1, 1 While Not rs_db.eof wscript.echo rs_db("this_domain_name") domains_file = domains_file & "[" &rs_db("this_domain_name")& "]" &vbNewLine &_ "FQDN=mail.gigamail.nl" & vbNewLine &_ "IP=127.0.0.1" & vbNewLine &_ "MaxInactive=0" & vbNewLine &_ "MaxMessageAge=0" & vbNewLine &_ "MaxDeletedIMAPMessageAge=0" & vbNewLine &_ "POP_Throttle=0" & vbNewLine &_ "IMAP_Throttle=0" & vbNewLine &_ "MultiPOP_Throttle=0" & vbNewLine &_ "DomainPOP_Throttle=0" & vbNewLine &_ "InboundSMTP_Throttle=0" & vbNewLine &_ "OutboundSMTP_Throttle=0" & vbNewLine &_ "Bind=No" & vbNewLine &_ "RecurseIMAP=No" & vbNewLine &_ "EnableAntiVirus=Yes" & vbNewLine &_ "EnableAntiSpam=Yes" & vbNewLine &_ "DomainAdmins=info@"&rs_db("this_domain_name")& vbNewLine &_ "MaxUsers=-1" & vbNewLine &_ "MaxLists=-1" & vbNewLine filesys.CreateFolder(str_mdaemon_path&"Domains\"&rs_db("this_domain_name")) rs_db.MoveNext Wend rs_db.close TXTdomains.Write(domains_file) '###CLOSE CONNECTION AND OBJECTS.### set TXTdomains = Nothing Set filesys = Nothing set obj_shell = Nothing dbconnection.close Set rs_db = Nothing set dbconnection= Nothing