Richard,

I like what you have done with the script! Good stuff.

I am going to do some addtional testing.

Comments:
  • I commented out the "Explorer View" under version 10/11 {XP/2003} (especially 11) as Microsoft re-vamped the Outlook Interface..
  • IM (under version 10/11) - should this not not be written to the Registry out before running Outlook?
  • Have you tried to get profile generation working with TransForms as the Office Resource Kit? I think this would be the preferred method, but I have yet to have success with it.
Here is what I have at this point:
code:
 $company='CSIRO'
; Do you want users to delete all deleted items on Exit from Outlook?
$deleteitems='Yes'

IF @inwin=1
; Windows NT Registry Locations
$profilelocation='HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\'
ELSE
; Windows 9x Registry Locations
$profilelocation='HKCU\Software\Microsoft\Windows Messaging Subsystem\Profiles\'
ENDIF

$outlookexe=ReadValue('HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\Outlook.EXE','')
; Get version of executable for MS-Outlook
$outlookversion=GetFileVersion($outlookexe)
$vers=SubStr($outlookversion,1,InStr($outlookversion,'.')+1)

$defaultprofile=ReadValue($profilelocation,'DefaultProfile')

; If no default profile exists, the outlook profile is not the default or the default profile is incorrectly configured,
; setup a new profile for the user
IF $defaultprofile=''
OR NOT KeyExist($profilelocation+$defaultprofile)
OR NOT InStr(ReadValue($profilelocation+$defaultprofile+'\13dbb0c8aa05101a9bb000aa002fc45a','001e3001'),$lastname)

; Copy the default profile to the temporary directory
COPY $exepath+'\Outlook\Custom.PRF' $temp
$customprofile=$temp+'\Custom.PRF'
IF $homedrive='' $homedrive='U:'
ENDIF
; Change the PRF file from %username% to @USERID
; Profile name
$=WriteProfileString($customprofile,'General','ProfileName','@USERID')
; Auto archive file
$=WriteProfileString($customprofile,'General','AutoArchiveFile',$homedrive+'\@USERID.pst')
; Auto archive file
$=WriteProfileString($customprofile,'Service1','AutoArchiveFile',$homedrive+'\@USERID.pst')
; Mail box name
$=WriteProfileString($customprofile,'Service1','MailBoxName','@USERID')
; Mail box name
$=WriteProfileString($customprofile,'Service2','MailBoxName','@USERID')
; Exchange server
$=WriteProfileString($customprofile,'Service2','HomeServer',$exchangeserver)
; Personal folder location
IF $mappref='Yes'
$=WriteProfileString($customprofile,'Service3','PathToPersonalFolders',$homedrive+'\@USERID.PST')
ELSE
$=WriteProfileString($customprofile,'Service3','PathToPersonalFolders',$temp+'\@USERID.PST')
ENDIF

$officelm='HKLM\Software\Microsoft\Office'
$officecu='HKCU\Software\Microsoft\Office'

; Process Company Name
FOR $x=1 TO Len($company)
$companybin=$companybin+DecToHex(Asc(SubStr($company,$x,1)))+'00'
NEXT
$companybin=$companybin+'0000'
$=WriteValue($officecu+'\'+$vers+'\Common\UserInfo','Company',$companybin,'REG_BINARY')

; Process FullName
FOR $x = 1 TO Len(@fullname)
$fullnamebin=$fullnamebin+DecToHex(Asc(SubStr(@fullname,$x,1)))+'00'
NEXT
$fullnamebin=$fullnamebin+'0000'
$=WriteValue($officecu+'\'+$vers+'\Common\UserInfo','UserName',$fullnamebin,'REG_BINARY')

; Process Initials
$initials=DecToHex(Asc(SubStr($firstname,1,1)))+'000000'
$=WriteValue($officecu+'\'+$vers+'\Common\UserInfo','UserInitials',$initials,'REG_BINARY')

SELECT
; If it is Outlook 98 or Outlook 2000, configure the following keys and values (e.g. 9.0.0.2416)
CASE
$Vers='8.0' OR $Vers = '9.0'
; Generate the Inbox
; If you use RUN instead of SHELL, the script will pause and not complete properly
SHELL $exepath+'\Outlook\Profgen.exe '+$exepath+'\Outlook\NEWPROF.EXE -P '+$customprofile+' -X -R'
; Create default profile
$=WriteValue($profilelocation,'DefaultProfile', @userid, 'REG_SZ')
; Check the box to empty deleted items on leaving Outlook - Now the we have the Outlook Profile Generated
IF $deleteitems = 'Yes'
$=WriteValue($profilelocation+@userid+'\0a0d020000000000c000000000000046','000b0115','0100','REG_BINARY')
ENDIF
; Company
$=WriteValue($officecu+'\'+$vers+'\Common\UserInfo','Company','435349524F','REG_BINARY')
; Set the Machine Name
$=WriteValue($officecu+'\'+$vers+'\Outlook','Machine Name',@wksta,'REG_SZ')
; Check Internet E-Mail Accounts
$=WriteValue($officecu+'\'+$vers+'\Outlook','CheckInternetAccounts','1','REG_DWORD')
; Has Outlook been Setup?
$=WriteValue($officecu+'\'+$vers+'\Outlook','FirstRunDialog','False','REG_SZ')
; Primary Client?
$=WriteValue($officecu+'\'+$vers+'\Outlook\Setup','PrimaryClient','1','REG_DWORD')
; Corporate or POP3? - Needs to be a machine setting
$=WriteValue($officelm+'\'+$vers+'\Outlook\Setup','MailSupport','1','REG_DWORD')
; Corporate or POP3? - Needs to be a machine setting
$=WriteValue($officelm+'\'+$vers+'\Outlook\Setup','First-Run','df83b12adc9cd511b57c0002a57ce19c','REG_BINARY')

; Set the default mail preference as Rich Text format 196609 is Word, 199610 Rich Text Format
$=WriteValue($officecu+'\'+$vers+'\Outlook\Options\Mail','EditorPreference','196609','REG_DWORD')

$=WriteValue($profilelocation+@userid+'\0a0d020000000000c000000000000046','001e0360','','REG_SZ')
; Changes the view to get rid of the Outlook Bar and show the 'Explorer View'
$expview='010000002c0000000200000003000000ffffffffffffffffffffffffffffffff'
$expview=$expview+'62000000270000003c030000ac02000001000000000000000100000000000000'
$expview=$expview+'c00000006400000003000000'
$=WriteValue($officecu+'\'+$vers+'\Outlook\Office Explorer','Frame',$expview,'REG_BINARY')
; Set the default Font to be Verdana 10 pt
$pltextfont='3c0000000f0000e800000040c80000000600000000000000002056657264616e61'
$pltextfont=$pltextfont+'000200000000000000000000000000201a493a38e9070001000000'
$=WriteValue($officecu+'\'+$vers+'\Outlook\Preferences','PlainTextFont',$pltextfont,'REG_BINARY')
; If it is Outlook 2002 or 2003, configure the following keys and values
CASE
$Vers = '10.0' OR $Vers='11.0'
; No extra EXEs or files other than the PRF needed for Outlook 2002 or 2003
; This is discussed at: http://www.slipstick.com/outlook/ol2002/prftips.htm
$=WriteProfileString($customprofile,'General','BackupProfile','NO')
; This is discussed at the bottom of - http://www.microsoft.com/office/ork/xp/four/outc03.htm
$=WriteValue($officecu+'\'+$vers+'\Outlook\Setup','ImportPRF',$customprofile,'REG_SZ')
$=WriteValue($officecu+'\'+$vers+'\Outlook','Machine Name','@WKSTA','REG_SZ')
$=DelValue($officecu+'\'+$vers+'\Outlook\Setup','First-run')
; Import the profile for outlook
RUN $outlookexe+' /importprf '+$customprofile
SLEEP 1

; Set the default mail preference as Rich Text format 196609 is Word, 199610 Rich Text Format
$=WriteValue($officecu+'\'+$vers+'\Outlook\Options\Mail','EditorPreference','196609','REG_DWORD')
; Set the default mail editor to word
$=WriteValue($officecu+'\'+$vers+'\Outlook\Options\Mail','UseWordMail','1','REG_DWORD')
; Set the default Font to be Verdana 10 pt
$pltextfont='3c0000000f0000e800000040c80000000600000000000000002056657264616e610002'
$pltextfont=$pltextfont+'00000000000000000000000000201a493a38e9070001000000'
$=WriteValue($officecu+'\'+$vers+'\Outlook\Preferences','TextFontSimple',$pltextfont,'REG_BINARY')
; Changes the view to get rid of the Outlook Bar and show the 'Explorer View'
;>>> Under OutlooK XP 2003, I would be careful about this..
;$expview='010000002c0000000200000003000000ffffffffffffffffffffffffffffffff'
;$expview=$expview+'2c0000002c00000084020000dc01000001000000000000000100000'
;$expview=$expview+'2000000000c0000000640000001800000003000000'
;$=WriteValue($officecu+'\'+$vers+'\Outlook\Office Explorer','Frame',$expview,'REG_BINARY')
;Check the box to empty deleted items on leaving Outlook - Now the we have the Outlook Profile Generated
IF $deleteitems = 'Yes'
$=WriteValue($officecu+'\'+$vers+'\Outlook\Preferences','EmptyTrash','1','REG_DWORD')
ENDIF
; Disable Instant Messaging
$=WriteValue($officecu+'\'+$vers+'\Outlook\IM','Enabled','0','REG_DWORD')
ENDSELECT
ELSE
ENDIF
SLEEP 0.75
RETURN

Kent

[ 05. November 2003, 14:12: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's