I am having a issue with the outlook configuration script. It works great when there is no profile built at all for the user but if the machine that you are logging onto has any profile at all it won't delete those profiles and then proceed to build the new one for the user logging in.
Here is the script im using: (note i have excluded the exchange server & company for security reasons)
Code:
OUTLOOK
; -- OUTLOOK - ALL >> MAIN CONFIGURATION FOR MICROSOFT OUTLOOK TO EXCHANGE SERVERS
FUNCTION OUTLOOK()
DIM $profile_remove,$deleteitems,$explorview,$editorpref,$prf,$company,$serverloc,$exchangeserver,
$ushefolders,$userwinkey,$machinewinkey,$mofckey,$uofckey,$profilelocation,$scriptdir,$profiledir,
$prffile,$ppru,$mses,$exe,$ver,$verchk,$index,$keyname
$profile_remove='Yes' ; Remove All other Outlook profiles under current user
$deleteitems='no'; Empty Outlooks Deleted Items Folder on Exit
$explorview='Yes' ; Outlook Explorer View 'Yes' or Standard View 'No'
$editorpref='30001' ; Editor Preference 10001=Plain Text, 20001=HTML, and 30001=Rich Text
$prf='Outlook.prf'
$company='company'
$serverloc=@lserver+'\Netlogon\Profgen\Outlook2000' ; Outlook Executables files location
$exchangeserver='exchangeserver' ; Main Exchange Server Location
$ushefolders='HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'
$userwinkey='HKCU\Software\Microsoft\Windows'
$machinewinkey='HKLM\Software\Microsoft\Windows'
$mofckey='HKLM\Software\Microsoft\Office\'
$uofckey='HKCU\Software\Microsoft\Office\'
IF @inwin=1
;Windows NT/2k/XP/2003
$profilelocation=$userwinkey+' NT\CurrentVersion\Windows Messaging Subsystem\Profiles'
ELSE
;Windows 9x
$profilelocation=$userwinkey+' Messaging Subsystem\Profiles'
ENDIF
$scriptdir=split('%WINDIR%',':')[0]+':\Scripts'
$profiledir='%temp%'
$prffile=$profiledir+'\'+$prf
;$prffile=$scriptdir+'\'+$prf
$ppru=$profilelocation+'\'+@userid
$mses=$profilelocation+'\MS Exchange Settings'
$exe=ReadValue($machinewinkey+'\CurrentVersion\App Paths\OUTLOOK.EXE','')
$ver=GetFileVersion($exe)
$verchk=SPLIT($ver,'.')[0]
IF 0=Exist($scriptdir)
MD $scriptdir
ENDIF
; -- IF YOU WANT TO REMOVE THE OFFICE PERSONALIZATION, COMMENT THE NEXT LINE
MSUSERINFO($uofckey,$verchk)
IF INGROUP('A GROUP')
IF READVALUE($ppru+'\13dbb0c8aa05101a9bb000aa002fc45a','001e6602')=$exchangeserver
RETURN
ELSE
IF 0=Exist ($scriptdir+'\profupdt.exe') ; - profupdt.exe is from Exchange 24/7
COPY $serverloc+'\profupdt.exe' $scriptdir
ENDIF
SHELL '%COMSPEC% /C '+$scriptdir+'\profupdt.exe '+$exchangeserver
;SHELL '%COMSPEC% /C '+$scriptdir+'\Modprof.exe -p '+$prffile
RETURN
ENDIF
ENDIF
IF KeyExist($ppru) OR KeyExist($mses)
RETURN
ELSE
COPY $serverloc+'\'+$prf $profiledir+'\'+$prf
PRFSETTINGS($prffile,$exchangeserver,$deleteitems)
; Custom Profile Settings
IF $profile_remove='YES'
$index=0
$keyname=EnumKey($profilelocation,$index)
WHILE @error=0
IF $keyname<>@userid $rc=DelTree($profilelocation+'\'+$keyname)
ENDIF
$index=$index+1
$keyname=EnumKey($profilelocation,$index)
LOOP
ENDIF
SELECT
CASE
$verchk=8 or $verchk=9 ;(e.g. 8.5.5104.0) OR (e.g. 9.0.0.2416)
OUTLOOK8AND9($verchk+'.0',$scriptdir,$prffile,$mofckey,$uofckey,$serverloc,$explorview,$profilelocation)
RETURN
CASE
$verchk=10 or $verchk=11 ;(e.g. 10.0.2627.1) OR (e.g. 11.0.5329.6)
;$ver=$verchk+'.0'
OUTLOOK10AND11($verchk+'.0',$uofckey,$prffile,$explorview)
RETURN
ENDSELECT
ENDIF
ENDFUNCTION
; -- OUTLOOK BRANCHOUT FOR OUTLOOK XP/2003 - ALL
FUNCTION OUTLOOK10AND11($vers,$uofckey,$prffile,$explorview)
DIM $rc,$expview
$rc=DelValue($uofckey+$vers+'\Outlook\Setup','First-Run')
$rc=WriteValue($uofckey+$vers+'\Outlook\Setup','ImportPRF',$prffile,'REG_SZ')
SLEEP 1
;If '196610'<>ReadValue($uofckey+$vers+'\Outlook\Options\Mail','EditorPreference')
; $rc=WriteValue($uofckey+$vers+'\Outlook\Options\Mail','EditorPreference','196610','REG_DWORD')
;EndIf
;$pltextfont='3c0000000f0000e800000040c80000000600000000000000002056657264616e6100020000000000000000'
;$pltextfont=$pltextfont+'0000000000201a493a38e9070001000000'
;$rc=WriteValue($uofckey+$vers+'\Outlook\Preferences','TextFontSimple',$pltextfont,'REG_BINARY')
IF $explorview='Yes'
$expview='010000002c0000000200000003000000ffffffffffffffffffffffffffffffff2c0000002c00000084'
$expview=$expview+'020000dc01000001000000000000000100000000000000c0000000640000001800000003000000'
$rc=WriteValue($uofckey+$vers+'\Outlook\Office Explorer','Frame',$expview,'REG_BINARY')
ENDIF
IF $vers='10.0' ; - TURN OFF INSTANT MESSAGING FOR OUTLOOK-XP
$rc=ADDKEY($uofckey+$vers+'\Outlook\IM')
$rc=WriteValue($uofckey+$vers+'\Outlook\IM','Enabled',0,'REG_DWORD')
ENDIF
ENDFUNCTION
; -- OUTLOOK BRANCH OUT FOR OUTLOOK 98/2000
FUNCTION OUTLOOK8AND9($vers,$scriptdir,$prffile,$mofckey,$uofckey,$serverloc,$explorview,$profilelocation)
DIM $expview,$rc
IF 0=Exist ($scriptdir+'\Profgen.exe')
COPY $serverloc+'\Profgen.exe' $scriptdir
ENDIF
IF 0=Exist ($scriptdir+'\NEWPROF.EXE')
COPY $serverloc+'\NEWPROF.EXE' $scriptdir
ENDIF
IF @inwin=1
SHELL '%COMSPEC% /C '+$scriptdir+'\Profgen.exe '+$scriptdir+'\Newprof.exe -p '+$prffile+' -X -R -L > nul'
ELSE
SHELL '%COMSPEC% /C '+$scriptdir+'\Newprof.exe -p '+$scriptdir+' -X -R -L > nul'
ENDIF
SLEEP 1
IF $explorview='Yes'
IF 0=KeyExist($mofckey+$vers)
$rc=AddKey($mofckey+$vers)
ENDIF
IF 0=KeyExist($uofckey+$vers)
$rc=AddKey($uofckey+$vers)
ENDIF
IF 0=KeyExist($mofckey+$vers+'\Common')
$rc=AddKey($mofckey+$vers+'\Common')
ENDIF
IF 0=KeyExist($uofckey+$vers+'\Common')
$rc=AddKey($uofckey+$vers+'\Common')
ENDIF
IF 0=KeyExist($uofckey+$vers+'\Preferences')
$rc=AddKey($uofckey+$vers+'\Preferences')
ENDIF
IF 0=KeyExist($uofckey+$vers+'\Common\UserInfo')
$rc=AddKey($uofckey+$vers+'\Common\UserInfo')
ENDIF
IF 0=KeyExist($mofckey+'Outlook')
$rc=AddKey($mofckey+'Outlook')
ENDIF
IF 0=KeyExist($uofckey+$vers+'\Outlook\Options')
$rc=AddKey($uofckey+$vers+'\Outlook\Options')
ENDIF
IF 0=KeyExist($uofckey+$vers+'\Outlook\Options\Mail')
$rc=AddKey($uofckey+$vers+'\Outlook\Options\Mail')
ENDIF
IF 0=KeyExist($mofckey+$vers+'\Outlook\Setup')
$rc=AddKey($mofckey+$vers+'\Outlook\Setup')
ENDIF
IF 0=KeyExist($uofckey+$vers+'\Outlook\Office Explorer')
$rc=AddKey($uofckey+$vers+'\Outlook\Office Explorer')
ENDIF
IF @wksta<>ReadValue($uofckey+$vers+'\Outlook','Machine Name')
$rc=WriteValue($uofckey+$vers+'\Outlook','Machine Name',@wksta,'REG_SZ')
ENDIF
IF 1<>ReadValue($uofckey+$vers+'\Outlook','CheckInternetAccounts')
$rc=WriteValue($uofckey+$vers+'\Outlook','CheckInternetAccounts','1','REG_DWORD')
ENDIF
IF 'False'<>ReadValue($uofckey+$vers+'\Outlook','FirstRunDialog')
$rc=WriteValue($uofckey+$vers+'\Outlook','FirstRunDialog','False','REG_SZ')
ENDIF
IF 1<>ReadValue($uofckey+$vers+'\Outlook\Setup','PrimaryClient')
$rc=WriteValue($uofckey+$vers+'\Outlook\Setup','PrimaryClient','1','REG_DWORD')
ENDIF
IF 1<>ReadValue($mofckey+$vers+'\Outlook\Setup','MailSupport')
$rc=WriteValue($mofckey+$vers+'\Outlook\Setup','MailSupport','1','REG_DWORD')
ENDIF
IF 1<>ReadValue($mofckey+$vers+'\Outlook\Setup','First-Run')
$rc=WriteValue($mofckey+$vers+'\Outlook\Setup','First-Run','df83b12adc9cd511b57c0002a57ce19c','REG_BINARY')
ENDIF
;If '196610'<>ReadValue($uofckey+$vers+'\Outlook\Options\Mail','EditorPreference')
; $rc=WriteValue($uofckey+$vers+'\Outlook\Options\Mail','EditorPreference','196610','REG_DWORD')
;EndIf
$rc=WriteValue($profilelocation+@userid+'\0a0d020000000000c000000000000046','001e0360','','REG_SZ')
$expview='010000002c0000000200000003000000ffffffffffffffffffffffffffffffff62000000270000003'
$expview=$expview+'c030000ac02000001000000000000000100000000000000c00000006400000003000000'
$rc=WriteValue('HKCU\Software\Microsoft\Office\'+$vers+'\Outlook\Office Explorer','Frame',$expview,'REG_BINARY')
;$pltextfont='3c0000000f0000e800000040c80000000600000000000000002056657264616e6100020000000000000000'
;$pltextfont=$pltextfont+'0000000000201a493a38e9070001000000'
;$rc=WriteValue($uofckey+$vers+'\Outlook\Preferences','PlainTextFont',$pltextfont,'REG_BINARY')
ENDIF
ENDFUNCTION
; -- OUTLOOK PROFILE SETTINGS - ALL >> USED FOR OUTLOOK CONFIGURATION
FUNCTION PRFSETTINGS($prffile,$exchangeserver,$deleteitems)
DIM $rc
; Custom Profile Settings
IF @userid<>ReadProfileString($prffile,'General','ProfileName')
$rc=WriteProfileString($prffile,'General','ProfileName',@userid)
ENDIF
IF 'Yes'<>ReadProfileString($prffile,'General','DefaultProfile')
$rc=WriteProfileString($prffile,'General','DefaultProfile','Yes')
ENDIF
IF 'Yes'<>ReadProfileString($prffile,'General','OverwriteProfile')
$rc=WriteProfileString($prffile,'General','OverwriteProfile','Yes')
ENDIF
IF $exchangeserver<>ReadProfileString($prffile,'Service2','HomeServer')
$rc=WriteProfileString($prffile,'Service2','HomeServer',$exchangeserver)
ENDIF
IF @userid<>ReadProfileString($prffile,'Service2','MailboxName')
$rc=WriteProfileString($prffile,'Service2','MailboxName',@userid)
ENDIF
IF 'TRUE'<>ReadProfileString($prffile,'Service1','AutoNameCheck')
$rc=WriteProfileString($prffile,'Service1','AutoNameCheck','TRUE')
ENDIF
IF 'FALSE'<>ReadProfileString($prffile,'Service1','ConfirmOnDelete')
$rc=WriteProfileString($prffile,'Service1','ConfirmOnDelete','FALSE')
ENDIF
IF $deleteitems='YES'
IF 'TRUE'<>ReadProfileString($prffile,'Service1','EmptyWastebasket')
$rc=WriteProfileString($prffile,'Service1','EmptyWastebasket','TRUE')
ENDIF
ELSE
IF 'FALSE'<>ReadProfileString($prffile,'Service1','EmptyWastebasket')
$rc=WriteProfileString($prffile,'Service1','EmptyWastebasket','FALSE')
ENDIF
ENDIF
IF 'FALSE'<>ReadProfileString($prffile,'Service1','RemoveSchdPlus')
$rc=WriteProfileString($prffile,'Service1','RemoveSchdPlus','FALSE')
ENDIF
IF 'TRUE'<>ReadProfileString($prffile,'Service1','SelectEntireWord')
$rc=WriteProfileString($prffile,'Service1','SelectEntireWord','TRUE')
ENDIF
IF 'TRUE'<>ReadProfileString($prffile,'Service1','CloseOriginalMessage')
$rc=WriteProfileString($prffile,'Service1','CloseOriginalMessage','TRUE')
ENDIF
IF 'FALSE'<>ReadProfileString($prffile,'Service1','GenReadReceipt')
$rc=WriteProfileString($prffile,'Service1','GenReadReceipt','FALSE')
ENDIF
IF 'FALSE'<>ReadProfileString($prffile,'Service1','GenDeliveryReceipt')
$rc=WriteProfileString($prffile,'Service1','GenDeliveryReceipt','FALSE')
ENDIF
IF 'True'<>ReadProfileString($prffile,'Service1','SaveSentMail')
$rc=WriteProfileString($prffile,'Service1','SaveSentMail','True')
ENDIF
IF 'No'<>ReadProfileString($prffile,'General','BackupProfile')
$rc=WriteProfileString($prffile,'General','BackupProfile','No')
ENDIF
ENDFUNCTION
; -- MSUSERINFO - ALL - USED BY THE OUTLOOK CONFIGURATION FUNCTION
FUNCTION MSUSERINFO($uofckey,$ver)
DIM $x,$regexp,$company,$companybin,$fullnamebin,$useridbin,$initials,$regkey
IF KeyExist($uofckey)
; Process Company Name
$x=1
$regexp=''
WHILE $x<(Len($company)+1)
$regexp=$regexp+DecToHex(Asc(SubStr($company,$x,1)))+'00'
$x=$x+1
LOOP
$regexp=$regexp+'0000'
$companybin=$regexp
; Process FullName
$x=1
$regexp=''
WHILE $x<(Len(@fullname)+1)
$regexp=$regexp+DecToHex(Asc(SubStr(@fullname,$x,1)))+'00'
$x=$x+1
LOOP
$regexp=$regexp+'0000'
$fullnamebin=$regexp
; Process UserID
$useridbin=SubStr(@wuserid,1,2)
$x=1
$regexp=''
WHILE $x<(Len($useridbin)+1)
$regexp=$regexp+DecToHex(Asc(SubStr($useridbin,$x,1)))+'00'
$x=$x+1
LOOP
$regexp=$regexp+'0000'
$initials=$regexp
IF 0=KeyExist($uofckey+$ver+'.0\Common\UserInfo')
$rc=AddKey($uofckey+$ver+'.0\Common\UserInfo')
ENDIF
$regkey=$uofckey+$ver+'.0\Common\UserInfo'
IF KeyExist($regkey)
$rc=WriteValue($regkey,'Company',$companybin,'REG_BINARY')
$rc=WriteValue($regkey,'UserName',$fullnamebin,'REG_BINARY')
$rc=WriteValue($regkey,'UserInitials',$initials,'REG_BINARY')
ENDIF
ENDIF
ENDFUNCTION
A little more info on the problem im having. In our company before I was brought on, they set up a ghost build of ms 2000 & xp, in the ghost build for who nows what reason the default user profile has a outlook profile already built. So what happens is when you log into the machine for the first time it takes the settings for outlook from the default user. Then for some reason when you run the outlook.kix script it won't delete that default outlook profile and build the new one for that specific user logging in.
Any thoughts or help would be great 
Thanks,
Gummby