Ok.. Took a couple of moments and put together the "new" code.
Thanks to Rad for his insights on this..
Wrappped all of the functions into one, this should make more sense:
Code:
CLS
BREAK ON
???
OUTLOOK
; -- OUTLOOK - ALL >> MAIN CONFIGURATION FOR MICROSOFT OUTLOOK TO EXCHANGE SERVERS
FUNCTION OUTLOOK()
DIM $prfrem,$waste,$explorview,$editorpref,$prf,$company,$serverloc,
$exchgsvr,$prfloc,$prffile,$ppru,$exe,$ver,$idx,$keyname,$rc,
$outlook,$ns,$unread,$fldr,$x,$regexp,$companybin,$fullnamebin,$initials,$MSOdir
$prfrem='Yes' ; Remove All other Outlook profiles under current user
$waste='TRUE'; 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'
$prffile='%temp%\'+$prf
$company='Your_Company, Inc.'
$serverloc=@LSERVER+'\Netlogon\Profgen' ; Outlook Executables files location
$exchgsvr='YOUR_EXCHANGE_SERVER' ; Main Exchange Server Location
IF @INWIN ;Windows NT/2k/XP/2003
$prfloc='HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles'
ELSE
;Windows 9x
$prfloc='HKCU\Software\Microsoft\Windows Messaging Subsystem\Profiles'
ENDIF
$ppru=$prfloc+'\'+@USERID
$exe=ReadValue('HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE','')
$ver=SPLIT(GetFileVersion($exe),'.')[0]+'.0'
$MSOdir=SUBSTR($exe,1,Len($exe)-11)
IF ReadValue($prfloc,'DefaultProfile')<>@USERID 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 $prfrem='YES'
$idx=0
$keyname=EnumKey($prfloc,$idx)
WHILE @ERROR=0
IF $keyname<>@USERID $rc=DelTree($prfloc+'\'+$keyname) ENDIF
$idx=$idx+1
$keyname=EnumKey($prfloc,$idx)
LOOP
ENDIF
SELECT
CASE
$ver='8.0' OR $ver='9.0' ;(e.g. 8.5.5104.0)
IF @INWIN=1
;SHELL 'CMD /C '+$serverloc+'\Profgen.exe '+$serverloc+'\Newprof.exe -p '
;+$prffile+' -X -R -L -T %temp%> nul'
SHELL 'CMD /C '+$serverloc+'\modprof.exe -P '+$prffile+' -x'
ELSE
SHELL '%COMSPEC% /C '+$serverloc+'\Newprof.exe -p '+$serverloc+' -X -R -L > nul'
ENDIF
$rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook','Machine Name',@WKSTA,'REG_SZ')
$rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook','CheckInternetAccounts',1,'REG_DWORD')
$rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook','FirstRunDialog','False','REG_SZ')
$rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook\Setup','PrimaryClient',1,'REG_DWORD')
$rc=WriteValue('HKLM\Software\Microsoft\Office\'+$ver+'\Outlook\Setup','MailSupport',1,'REG_DWORD')
$rc=WriteValue('HKLM\Software\Microsoft\Office\'+$ver+'\Outlook\Setup','First-Run','df83b12adc9cd511b57c0002a57ce19c','REG_BINARY')
;$rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook\Options\Mail','EditorPreference','196610','REG_DWORD')
IF $explorview='Yes'
$rc=WriteValue($prfloc+@userid+'\0a0d020000000000c000000000000046','001e0360','','REG_SZ')
$expview='010000002c0000000200000003000000ffffffffffffffffffffffffffffffff62000000270000003'
$expview=$expview+'c030000ac02000001000000000000000100000000000000c00000006400000003000000'
$rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook\Office Explorer','Frame',$expview,'REG_BINARY')
ENDIF
; 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
$rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Common\UserInfo','Company',$companybin,'REG_BINARY')
; 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
$rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Common\UserInfo','UserName',$fullnamebin,'REG_BINARY')
; 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
$rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Common\UserInfo','UserInitials',$initials,'REG_BINARY')
DEL $MSOdir+'welcome.msg'
CASE
$ver='10.0' OR $ver='11.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
ENDSELECT
$outlook=CreateObject('Outlook.Application')
$ns=$outlook.getnamespace('MAPI')
$fldr=$ns.getdefaultfolder(6)
$unread=$fldr.unreaditemcount
$outlook=0
ENDIF
ENDFUNCTION
Thanks,
Kent