Page 1 of 1 1
Topic Options
#198974 - 2010-07-12 07:38 AM modify exmerge.ini for different sites
Jimay3677 Offline
Fresh Scripter

Registered: 2010-02-17
Posts: 9
Loc: Australia
Hi everyone, I have a kixtart login script which aswell as backing up to tape and disk runs exmerge to export mailboxes to folders/files.

I currently have 4 exmerge ini files for each of the 3 sites which has different servername, export locations and time stamps (12 files in total)

How can I make kixtart create a temporary copy of exmerge.ini with the server name etc etc rather than having all the separate files?

It would need to.
make a temp copy.
set servername, set backup location, timestamp (year) etc, run exmerge and delete the temp file then do it again with a different year etc etc?

Thanks.

Top
#198978 - 2010-07-12 10:40 AM Re: modify exmerge.ini for different sites [Re: Jimay3677]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
If the file is in proper ini format then you can use ReadProfilestring and WriteProfilestring to change the file. They are both explained in the manual.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#198979 - 2010-07-12 12:40 PM Re: modify exmerge.ini for different sites [Re: Mart]
Jimay3677 Offline
Fresh Scripter

Registered: 2010-02-17
Posts: 9
Loc: Australia
Here's what I came up with.
Very messy, any idea's how to make the code cleaner?

 Code:
Copy d:\Backups\EXMERGE.ini d:\Backups\EXMERGE.tmp.ini
WRITEPROFILESTRING ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SourceServerName", "BENSMTP")

;==================================
;Exmerge 2007
;==================================

WRITEPROFILESTRING ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "DataDirectoryName", "D:\Backup_temp\exchange\ben\2007")
WRITEPROFILESTRING ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SelectMessageStartDate", "01/01/2007  00:00:00")
WRITEPROFILESTRING ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SelectMessageEndDate", "12/31/2007  23:59:59")
Shell $exmergeexe

;==================================
;Exmerge 2008
;==================================

WRITEPROFILESTRING ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "DataDirectoryName", "D:\Backup_temp\exchange\ben\2008")
WRITEPROFILESTRING ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SelectMessageStartDate", "01/01/2008  00:00:00")
WRITEPROFILESTRING ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SelectMessageEndDate", "12/31/2008  23:59:59")
Shell $exmergeexe

;==================================
;Exmerge 2009
;==================================

WRITEPROFILESTRING ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "DataDirectoryName", "D:\Backup_temp\exchange\ben\2009")
WRITEPROFILESTRING ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SelectMessageStartDate", "01/01/2009  00:00:00")
WRITEPROFILESTRING ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SelectMessageEndDate", "12/31/2009  23:59:59")
Shell $exmergeexe
;==================================
;Exmerge 2010
;==================================

WRITEPROFILESTRING ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "DataDirectoryName", "D:\Backup_temp\exchange\ben\2010")
WRITEPROFILESTRING ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SelectMessageStartDate", "01/01/2010  00:00:00")
WRITEPROFILESTRING ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SelectMessageEndDate", "12/31/2010  23:59:59")
Shell $exmergeexe

del 'd:\Backups\EXMERGE.tmp.ini'


Edited by Mart (2010-07-12 12:55 PM)
Edit Reason: Please use code tags when posting code.

Top
#198980 - 2010-07-12 01:01 PM Re: modify exmerge.ini for different sites [Re: Jimay3677]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
The values to write are different for each file so there is not so much cleanup that can be done. Cleaned up the screen output by adding $rc = in front of each Writeprofilestring line. This eliminates all the return codes being displayed on the screen.

 Code:
Copy "d:\Backups\EXMERGE.ini" "d:\Backups\EXMERGE.tmp.ini"
$rc = WriteProfileString ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SourceServerName", "BENSMTP")

;==================================
;Exmerge 2007
;==================================
$rc = WriteProfileString ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "DataDirectoryName", "D:\Backup_temp\exchange\ben\2007")
$rc = WriteProfileString ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SelectMessageStartDate", "01/01/2007  00:00:00")
$rc = WriteProfileString ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SelectMessageEndDate", "12/31/2007  23:59:59")
Shell $exmergeexe

;==================================
;Exmerge 2008
;==================================
$rc = WriteProfileString ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "DataDirectoryName", "D:\Backup_temp\exchange\ben\2008")
$rc = WriteProfileString ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SelectMessageStartDate", "01/01/2008  00:00:00")
$rc = WriteProfileString ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SelectMessageEndDate", "12/31/2008  23:59:59")
Shell $exmergeexe

;==================================
;Exmerge 2009
;==================================
$rc = WriteProfileString ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "DataDirectoryName", "D:\Backup_temp\exchange\ben\2009")
$rc = WriteProfileString ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SelectMessageStartDate", "01/01/2009  00:00:00")
$rc = WriteProfileString ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SelectMessageEndDate", "12/31/2009  23:59:59")
Shell $exmergeexe

;==================================
;Exmerge 2010
;==================================
$rc = WriteProfileString ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "DataDirectoryName", "D:\Backup_temp\exchange\ben\2010")
$rc = WriteProfileString ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SelectMessageStartDate", "01/01/2010  00:00:00")
$rc = WriteProfileString ("d:\Backups\EXMERGE.tmp.ini", "EXMERGE", "SelectMessageEndDate", "12/31/2010  23:59:59")
Shell $exmergeexe

Del 'd:\Backups\EXMERGE.tmp.ini'
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1045 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.053 seconds in which 0.023 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org