New Postprepped code..




; -- OUTLOOK - ALL - MAIN CONFIGURATION FOR MICROSOFT OUTLOOK TO EXCHANGE SERVERS
; Function OUTLOOK()
;
; Author Kent Dyer (leptonator@hotmail.com
;
; Contributors Lonkero
; Matt "EvilHearted"
; Rad
; Anthony Harper
; mistajon (thanks for Outlook 2007 fix!)
;
; Action Configure Outlook
;
; Syntax OUTLOOK
;
; Version 1.21
;
; Date 1-April-2001
;
; Date Revised 11-March-2008
;
; Update Notes 15-July-2008 Remove Customer Experience from launching when you startup Outlook
; 11-March-2008 Remove Outlook 2000 and Window 9x
; Fixes $serverloc variable
; 18-Jan-2008 Added support for Outlook 2007 (version 12)
;
; Parameters none
;
; Remarks This function is used to configure Outlook with Exchange Server,
; Change 'MAILSVR' to your server name
;
; Returns Nothing
;
; Dependencies Outlook.prf
; http://www.microsoft.com/office/ork/2000/download/Outlook.prf
; http://download.microsoft.com/download/f/6/e/f6e04362-83d7-4107-be59-91e0658fa198/outlook.prf
;
; KiXtart Ver 4.02
;
; Example(s) OUTLOOK
FUNCTION OUTLOOK()
DIM $prfrem,$waste,$editorpref,$prf,$serverloc,
$exchgsvr,$prfloc,$prffile,$ppru,$exe,$ver,$idx,$keyname,$rc,
$outlook,$ns,$unread,$fldr,$x,$regexp,$MSOdir

$waste='FALSE' ; If set to TRUE, Empty Outlooks Deleted Items Folder on Exit
$editorpref=30001 ; Editor Preference 10001=Plain Text, 20001=HTML, and 30001=Rich Text
$prf='Outlook.prf'
$prffile='%temp%\'+$prf
$serverloc=@LSERVER+'\Profgen' ; Outlook .PRF location
$exchgsvr='MAILSVR' ; Main Exchange Server Location
$prfloc='HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles'
; -- Current User Profile
$ppru=$prfloc+'\'+@USERID

; -- Determine version of Outlook
$exe=ReadValue('HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE','')
$ver=SPLIT(GetFileVersion($exe),'.')[0]+'.0'
; -- Determine location of Office
$MSOdir=SUBSTR($exe,1,Len($exe)-11)

; -- This is used for when you have people come into the company from another Exchange Server into yours
; -- This is an Optional section
;IF INGROUP('GROUPNAME') AND READVALUE($ppru+'\13dbb0c8aa05101a9bb000aa002fc45a','001e6602')<>$exchgsvr
; $rc=WriteValue($ppru+'\13dbb0c8aa05101a9bb000aa002fc45a','001e6602',$exchgsvr,'REG_SZ')
; $rc=WriteValue($ppru+'\13dbb0c8aa05101a9bb000aa002fc45a','001e6608',$exchgsvr,'REG_SZ')
;ENDIF

; -- Look for Outlook Profile
IF (ReadValue($prfloc,'DefaultProfile')<>@USERID AND NOT INSTR(ReadValue($prfloc,'DefaultProfile'),'MS Exchange')) OR @ERROR
COPY $serverloc+'\'+$prf $prffile
$rc=WriteProfileString($prffile,'General','ProfileName',@USERID)
$rc=WriteProfileString($prffile,'General','DefaultProfile','Yes')
$rc=WriteProfileString($prffile,'General','OverwriteProfile','Yes')
$rc=WriteProfileString($prffile,'General','BackupProfile','No')
$rc=WriteProfileString($prffile,'Service1','AutoNameCheck','TRUE')
$rc=WriteProfileString($prffile,'Service1','EmptyWastebasket',$waste)
$rc=WriteProfileString($prffile,'Service1','CloseOriginalMessage','TRUE')
$rc=WriteProfileString($prffile,'Service2','HomeServer',$exchgsvr)
$rc=WriteProfileString($prffile,'Service2','MailboxName',@USERID)

;If Needed, you may want to uncomment the next line
;$ver='10.0' OR $ver='11.0' OR $ver='12.0';(e.g. 10.0.2627.1)
$rc=DelValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook\Setup','First-Run')
$rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook\Setup','ImportPRF',$prffile,'REG_SZ')
IF $ver='10.0'
$rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook\IM','Enabled',0,'REG_DWORD')
ENDIF
$rc=WriteValue('HKCU\Software\Microsoft\Office\Common','QMEnable',0,'REG_DWORD') ; -- Turn off User Feedback
; -- This was added as we needed to generate Outlook Profiles in a Citrix Session - thanks Rad!
$outlook=CreateObject('Outlook.Application')
$ns=$outlook.getnamespace('MAPI')
$fldr=$ns.getdefaultfolder(6)
$unread=$fldr.unreaditemcount
$outlook=0
DEL $MSOdir+'welcome.msg' ; -- Delete welcome message
ENDIF
ENDFUNCTION





Edited by Kdyer (2008-07-15 09:24 PM)
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's