Hi Kent,

Below is my code, I run a GUI logon script and have I have therefore removed the GUI features from the code below. I also log the progress of the script as I have routine that emails relevant IT staff the log file if the script comes up with errors.

I guess that main change I have made to your code is that the new profile generation will only occur if a correct existing profile is not already setup for that specific user. If you think any of the mods are useful please feel free to include any in your code.

Thanks again,

Richard

code:
:Outlook

$=Log("Microsoft Outlook",,Chr(175))

$Company="CSIRO"
; Do you want users to delete all deleted items on Exit from Outlook?
$DeleteItems = "Yes"
; Is it Winnt or 2K?
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)
; Log the outlook version
$=Log(Spacing("Version",50)+"- ")
Select
Case $Vers="8.0"
$=Log("Outlook 98",1)
Case $Vers="9.0"
$=Log("Outlook 2000",1)
Case $Vers="10.0"
$=Log("Outlook 2002",1)
Case $Vers="11.0"
$=Log("Outlook 2003",1)
Case 1
$=Log("No known version of Outlook is installed",2)
Sleep 0.75
Return
EndSelect

$=Log(Spacing("Checking for configured profile",50)+"- ")

$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)
Select
Case $DefaultProfile=""
$=Log("No default profile exists",1)
$=Log("Creating profile",1)
$Progress.currentprogress=$Progress.currentprogress+1

Case NOT KeyExist($ProfileLocation+$DefaultProfile)
$=Log("Outlook profile is not the default",1)
$=Log("Reconfiguring profile",1)
$Progress.currentprogress=$Progress.currentprogress+1

Case NOT InStr(ReadValue($ProfileLocation+$DefaultProfile+"\13dbb0c8aa05101a9bb000aa002fc45a","001e3001"),$LastName)
$=Log("Default profile is incorrectly configured",1)
$=Log("Reconfiguring profile",1)
$Progress.currentprogress=$Progress.currentprogress+1

EndSelect
; 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
$=Log(Spacing("Profile Name",50)+"- @USERID",1)
; Profile name
$=WriteProfileString($CustomProfile,"General","ProfileName","@USERID")
; Auto archive file
$=Log(Spacing("Auto Archive File",50)+"- "+$HomeDrive+"\@USERID.pst",1)
$=WriteProfileString($CustomProfile,"General","AutoArchiveFile",$HomeDrive+"\@USERID.pst")
; Auto archive file
$=WriteProfileString($CustomProfile,"Service1","AutoArchiveFile",$HomeDrive+"\@USERID.pst")
; Mail box name
$=Log(Spacing("Mail Box Name",50)+"- @USERID",1)
$=WriteProfileString($CustomProfile,"Service1","MailBoxName","@USERID")
; Mail box name
$=WriteProfileString($CustomProfile,"Service2","MailBoxName","@USERID")
; Exchange server
$=Log(Spacing("Exchange Server",50)+"- "+$ExchangeServer,1)
$=WriteProfileString($CustomProfile,"Service2","HomeServer",$ExchangeServer)
; Personal folder location
$=Log(Spacing("Path To Personal Folders",50)+"- ")
If $MapPref="Yes"
$=Log($HomeDrive+"\@USERID.pst",1)
$=WriteProfileString($CustomProfile,"Service3","PathToPersonalFolders",$HomeDrive+"\@USERID.PST")
Else
$=Log($Temp+"\@USERID.pst",1)
$=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("HKCU\Software\Microsoft\Office\"+$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("HKCU\Software\Microsoft\Office\"+$Vers+"\Common\UserInfo","UserName",$FullNamebin,"REG_BINARY")

; Process Initials
$Initials=DecToHex(Asc(SubStr($FirstName,1,1)))+"000000"
$=WriteValue("HKCU\Software\Microsoft\Office\"+$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"
$=Log(Spacing("Outlook Version",50)+"- ")
If $Vers="8.0" $=Log("Outlook 98",1) EndIf
If $Vers="9.0" $=Log("Outlook 2000",1) EndIf
; 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"
If @ERROR $=Log(Spacing("Creating Profile",50)+"- "+@SERROR,2,,"Outlook Profile creation on @WKSTA did not run correctly") Else $=Log(Spacing("Creating Profile",50)+"- "+@SERROR,2) EndIf
$Progress.currentprogress=$Progress.currentprogress+1

; 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
$Progress.currentprogress=$Progress.currentprogress+1
; 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("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\"+@USERID+"\0a0d020000000000c000000000000046","001e0360","","REG_SZ")

; Changes the view to get rid of the Outlook Bar and show the "Explorer View"
$Expview = "010000002c0000000200000003000000ffffffffffffffffffffffffffffffff62000000270000003c030000ac02000001000000000000000100000000000000c00000006400000003000000"
$=WriteValue($OfficeCU+"\"+$Vers+"\Outlook\Office Explorer","Frame",$Expview,"REG_BINARY")

; Set the default Font to be Verdana 10 pt
$PlTextFont = "3c0000000f0000e800000040c80000000600000000000000002056657264616e61000200000000000000000000000000201a493a38e9070001000000"
$=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"
$=Log(Spacing("Outlook Version",50)+"- ")
If $Vers="10.0" $=Log("Outlook 2002",1) EndIf
If $Vers="11.0" $=Log("Outlook 2003",1) EndIf

; 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
If @ERROR $=Log(Spacing("Creating Profile",50)+"- "+@SERROR,2,,"Outlook Profile creation on @WKSTA did not run correctly") Else $=Log(Spacing("Creating Profile",50)+"- "+@SERROR,2) EndIf
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 = "3c0000000f0000e800000040c80000000600000000000000002056657264616e61000200000000000000000000000000201a493a38e9070001000000"
$=WriteValue($OfficeCU+"\"+$Vers+"\Outlook\Preferences","TextFontSimple",$PlTextFont,"REG_BINARY")

; Changes the view to get rid of the Outlook Bar and show the "Explorer View"
$Expview = "010000002c0000000200000003000000ffffffffffffffffffffffffffffffff2c0000002c00000084020000dc01000001000000000000000100000000000000c0000000640000001800000003000000"
$=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 $=Log("Outlook Profile is already configured",2)
EndIf

Sleep 0.75

Return