you still left the iif like it was.
well, I took the liberty to change your latest:

function OutlookProfile($ProfileName, $ModProfDir, $ExchangeServer, $account, optional $default)
dim $tempfile

$WMSProfiles = 'HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles'
$tempfile = '%temp%\modprof.prf'
if not keyexist($WMSProfiles+'\'+$ProfileName)
copy '$ModProfDir\modprof.prf' $tempfile
$ = WRITEPROFILESTRING ($tempfile, 'General', "ProfileName",$ProfileName)
$ = WRITEPROFILESTRING ($tempfile, 'Service2',"HomeServer", $ExchangeServer)
$ = WRITEPROFILESTRING ($tempfile, 'Service2',"MailBoxName",$account)
SHELL 'cmd /c $ModProfDir\modprof.exe -P $tempfile -x'
if @error
exit @error
endif
sleep 1
DEL $tempfile
endif
if $default
$ = writeValue($WMSProfiles,'DefaultProfile',$ProfileName,REG_SZ)
if @error
exit @error
endif
endif
endfunction



anyway, got another question...
what if there is profile with same name but with wrong values?
_________________________
!

download KiXnet