This is the full extended version of the Outlook/Exchange profile generation script.

Still working on setting the default font.. {Now Works!}

Here goes..

code:
 
BREAK ON
CLS
; -- Outlook 98/2000/XP Configuration
; -- Kent Dyer
; -- Updated 19-August-2002
; -- Tested with Kixtart - 3.63, 4.10
; -- Test Environments - NT 4.0, W2k, WXP
; -- Used some ideas from MCA's KIXnnnUPDATE.EXE script
; -- Visit: http://home.wanadoo.nl/scripting/
; -- Originally created 15-August-2001
; -- http://kixtart.org/board/ultimatebb.php?ubb=get_topic;f=10;t=000021
; -- This completes the setup of Outlook
; -- Yes, you can use PROFGEN and FIXPRF, but these alone don't complete the setup
; -- They are, however necessary to complete this piece of the script
; -- Key points:
; -- * Changes the view to get rid of the Outlook Bar and show the "Explorer View"
; -- * Checks the box to empty deleted items on leaving Outlook
; -- * Also deletes bogus profiles like OEM User, etc.
; -- Changes Necessary:
; -- >>>> Company key needs to be changed to yours....
; -- Comments and feedback are welcome to - dyerkb@myrealbox.com
; -- 27-August-2001 - Fixed Registry Key problem, CHKEXCHG.EXE - Not required
; -- 17-February-2002 - Added in compatibility for Windows 9x
; -- 12-March-2002 - Added Ability to turn on/off empty deleted items on exit and removal of bogus profiles
; -- 18-July-2002 - Added in the ability to configure Outlook XP, updated Micrsoft Links
; -- 15-August-2002 - Fixed detection problem, 0 = EXISTKEY with an OR Statment bombs on 3.63
; -- 19-August-2002 - Increased testing with EXISTKEY and related changes
; --- **** The following Resources were used in this composition ****
; -- http://www.microsoft.com/office/ork/2000/download/Outlook.prf - sample PRF file
; -- http://support.microsoft.com/default.aspx?scid=kb;EN-US;q182035 - Windows 95 roving users setup
; -- ftp://ftp.microsoft.com/bussys/exchange/exchange-unsup-ed/profgen.zip - Contains PROFGEN.EXE
; -- Automate Outlook Profile Creation Using PRFPATCH:
; -- http://www.microsoft.com/technet/archive/default.asp?url=/TechNet/archive/office/office97/deploy/prfpatch.asp
; -- http://www.microsoft.com/technet/downloads/exe/profile.exe - PRFPATCH.EXE, sample PRF File
; -- http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q145905 - NEWPROF command-line options
; -- http://www.microsoft.com/office/ork/appa/appa.htm - Microsoft Office 97 Resource Kit Tools and Utilities page
; -- http://www.microsoft.com/windows/zak/zakreqs.htm - Zero Administration Kit HomePage
; -- http://www.microsoft.com/ntworkstation/downloads/bin/zak/zak.exe - Download ZAK, Contains FIXPRF.EXE
; -- http://www.microsoft.com/office/ork/xp/journ/adminup.htm#Off2000
; --- **** Outlook XP ****
; -- You can use GPO Editor for deployment of Outlook XP
; -- You should be able to issue the following command line: outlook.exe /importprf \\server1\share\outlook.prf
; -- Ref. http://www.microsoft.com/technet/treeview/default.asp?url=/TechNet/prodtechnol/office/officexp/reskit/officexp/part5/c18dpou.asp
; -- Look under: "Customizing an Outlook Installation"
; -- Outlook 2002 (Outlook XP) - http://www.slipstick.com/outlook/ol2002.htm
; -- D:\PFILES\COMMON\SYSTEM\MAPI\1033\95\NEWPROF.EXE - Office 2000 CD
; -- D:\PFILES\COMMON\SYSTEM\MAPI\1033\NT\NEWPROF.EXE - Office 2000 CD
; -- Windows 9x options:
; -- WINSET.EXE is available on Win9x CD-ROM
; -- PUTINENV.EXE is available from http://www.jsiinc.com/dl/putinenv.exe
; -- For use of WINSET/PUTINENV, you may want to refer to - http://www.jsiinc.com/subd/tip1700/rh1786.htm

$profile_remove = "Yes" ; -- Profiles other than @USERID, like OEM User, MS Exchange Settings, etc. removed
$deleteitems = "No" ; -- Do you want your users to delete all deleted items on Exit from Outlook?
$explorview = "Yes" ; -- Do you want your users to view the "Explorer View" and not the Outlook bar in Outlook?

IF (@inwin = 1) ; -- Is it Winnt or 2K?
; -- Windows NT Registry Locations
$profilelocation = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
$windir = READVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion","SystemRoot")
ELSE
; -- Windows 9x Registry Locations
$profilelocation = "HKEY_CURRENT_USER\Software\Microsoft\Windows Messaging Subsystem\Profiles"
$windir = READVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion","SystemRoot")
ENDIF

$systemdrive = SUBSTR($windir,1,3) ; -- This will show C:\ or M:\ or what drive windows is installed on

; -- 19-August-2002 - Fixed detection problem, 0 = EXISTKEY with an OR Statment bombs on 3.63
$ppru = $profilelocation+"\"+@userid
;IF (ExistKey($ppru) = 0) OR (ExistKey($pprf) = 0)
IF (ExistKey($ppru) = 0)
RETURN ; -- Profile exists and return
ELSE
$exe = ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE","")
$ver = GetFileVersion($exe) ; -- Get version of executable for MS-Outlook
$pos_locat = INSTR($ver, ".") - 1 ; - Look for where the dot is

$verchk = SubStr ($ver,1,$pos_locat)

IF 1 <> EXIST($windir+"\Outlook.PRF")
COPY @ldrive+"PROFGEN\RBMG\Outlook2000\Outlook.PRF" $windir
ENDIF
IF 1 <> EXIST ($windir+"\Profgen.exe")
COPY @ldrive+"PROFGEN\RBMG\Outlook2000\Profgen.exe" $windir
ENDIF
IF 1 <> EXIST ($windir+"\NEWPROF.EXE")
COPY @ldrive+"PROFGEN\RBMG\Outlook2000\NEWPROF.EXE" $windir
ENDIF
IF EXIST ($windir+"\FixPrf.EXE")
DEL $windir+"\FixPrf.EXE"
ENDIF
IF EXIST($systemdrive+"PROFGEN.exe")
DEL $systemdrive+"PROFGEN.EXE"
ENDIF
IF EXIST($systemdrive+"NEWPROF.EXE")
DEL $systemdrive+"NEWPROF.EXE"
ENDIF

SELECT
CASE
$verchk = "8" ; -- If it is Outlook 98, configure the following keys and values (e.g. 8.5.5104.0)
IF $profile_remove = "YES" ; -- If it does not exist, delete out any odd-ball Profiles
$index = 0
:loop3
$keyname = ENUMKEY($profilelocation, $index)
IF @error = 0
;? "Name found: $KeyName" ; -- Uncomment for debugging
IF $keyname <> @userid OR $keyname <> "Sales" ; -- Going to check for @userid
$rc = DELTREE($profilelocation+"\"+$keyname)
;$RC = DELKEY($ProfileLocation, $KeyName)
$index = $index + 1
GOTO Loop3
ENDIF
ENDIF
ENDIF
;$returncode= EXISTKEY($pprofilelocation) OR EXISTKEY($pprofilelocationf)
$returncode= EXISTKEY($ppru)
IF $returncode <> 0
; -- If you use RUN instead of SHELL, the script will pause and not complete properly
SHELL "%COMSPEC% /C "+$windir+"\Profgen.exe "+$windir+"\NEWPROF.EXE -P "+$windir+"\Outlook.PRF"
SLEEP 1
$rc = writevalue($profilelocation, "DefaultProfile", @userid, "REG_SZ")
ENDIF
RETURN
CASE
$verchk = "9" ; -- If it is Outlook 2000, configure the following keys and values (e.g. 9.0.0.2416)
IF $profile_remove = "YES" ; -- If it does not exist, delete out any odd-ball Profiles
$index = 0
:loop4
$keyname = ENUMKEY($profilelocation, $index)
IF @error = 0
;? "Name found: $KeyName" ; -- Uncomment for debugging
IF $keyname <> @userid OR $keyname <> "Sales" ; -- Going to check for @userid
$rc = DELTREE($profilelocation+"\"+$keyname)
;$RC = DELKEY($ProfileLocation, $KeyName)
$index = $index + 1
GOTO Loop4
ENDIF
ENDIF
ENDIF
; -- Generate the Inbox
; -- Make sure you use PUTINENV.EXE and WINSET.EXE with 9x machines - We need to have the %USERNAME% available

; -- If you use RUN instead of SHELL, the script will pause and not complete properly
SHELL "%COMSPEC% /C "+$windir+"\Profgen.exe "+$windir+"\NEWPROF.EXE -P "+$windir+"\Outlook.PRF"

; -- Had to add a small pause
SLEEP 1
$rc = writevalue($profilelocation, "DefaultProfile", @userid, "REG_SZ")

; -- Check for the Default profile, if it does not exist, create it
IF @userid <> READVALUE( $profilelocation, "DefaultProfile" )
$rc = WRITEVALUE ($profilelocation, "DefaultProfile", @userid, "REG_SZ")
ENDIF

; -- Check the box to empty deleted items on leaving Outlook - Now the we have the Outlook Profile Generated
IF $deleteitems = "Yes"
IF "0100" <> READVALUE($ppru+"\0a0d020000000000c000000000000046","000b0115")
$rc = WRITEVALUE($ppru+"\0a0d020000000000c000000000000046","000b0115","0100","REG_BINARY")
ENDIF
ENDIF

; -- Changes the view to get rid of the Outlook Bar and show the "Explorer View"
IF $explorview = "Yes"

; -- CHECK FOR KEYS AND IF NEED BE, ADD THEM
; --- Check for the right keys
IF 0 <> EXISTKEY("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0")
$rc = ADDKEY("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0")
ENDIF
IF 0 <> EXISTKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0")
$rc = ADDKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0")
ENDIF
IF 0 <> EXISTKEY("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Common")
$rc = ADDKEY("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Common")
ENDIF
IF 0 <> EXISTKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common")
$rc = ADDKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common")
ENDIF
IF 0 <> EXISTKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Preferences")
$rc = ADDKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Preferences")
ENDIF
IF 0 <> EXISTKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common\UserInfo")
$rc = ADDKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common\UserInfo")
ENDIF
IF 0 <> EXISTKEY("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Outlook")
$rc = ADDKEY("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Outlook")
ENDIF
IF 0 <> EXISTKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Options")
$rc = ADDKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Options")
ENDIF
IF 0 <> EXISTKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Options\Mail")
$rc = ADDKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Options\Mail")
ENDIF
IF 0 <> EXISTKEY("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Outlook\Setup")
$rc = ADDKEY("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Outlook\Setup")
ENDIF
IF 0 <> EXISTKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Office Explorer")
$rc = ADDKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Office Explorer")
ENDIF

; -- Company
$rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common\UserInfo","Company","0000000000000000000000000000000000000000000000000000000000000000000000000","REG_BINARY")
; -- Set the Machine Name
IF @wksta <> READVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook","Machine Name")
$rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook","Machine Name",@wksta,"REG_SZ")
ENDIF
; -- Check Internet E-Mail Accounts
IF 1 <> READVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook","CheckInternetAccounts")
$rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook","CheckInternetAccounts","1","REG_DWORD")
ENDIF
; -- Has Outlook been Setup?
IF "False" <> READVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook","FirstRunDialog")
$rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook","FirstRunDialog","False","REG_SZ")
ENDIF
; -- Primary Client?
IF 1 <> READVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Setup","PrimaryClient")
$rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Setup","PrimaryClient","1","REG_DWORD")
ENDIF
; -- Corporate or POP3? - Needs to be a machine setting
IF 1 <> READVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Outlook\Setup","MailSupport")
$rc = WRITEVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Outlook\Setup","MailSupport","1","REG_DWORD")
ENDIF
; -- Corporate or POP3? - Needs to be a machine setting
IF 1 <> READVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Outlook\Setup","First-Run")
$rc = WRITEVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Outlook\Setup","First-Run","df83b12adc9cd511b57c0002a57ce19c","REG_BINARY")
ENDIF

; -- Set the default mail preference as Rich Text format 1996609 is Word, 199610 Rich Text Format
IF "196610" <> READVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Options\Mail","EditorPreference")
$rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Options\Mail","EditorPreference","196610","REG_DWORD")
ENDIF

$rc = WRITEVALUE("HKEY_CURRENT_USER\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 = "010000002c0000000200000003000000ffffffffffffffffffffffffffffffff62000000270000003"
$expview = $expview + "c030000ac02000001000000000000000100000000000000c00000006400000003000000"
$rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Office Explorer","Frame",$expview,"REG_BINARY")

; -- Set the default Font to be Verdana 10 pt
$pltextfont = "3c0000000f0000e800000040c80000000600000000000000002056657264616e6100020000000000000000"
$pltextfont = $pltextfont + "0000000000201a493a38e9070001000000"
$rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Preferences","PlainTextFont",$pltextfont,"REG_BINARY")
ENDIF
RETURN
CASE
$verchk = "10" ; -- If it is Outlook XP, configure the following keys and values
; -- No extra EXEs or files other than the PRF needed for Outlook XP
$winntfile = $windir+"\Outlook.PRF"

; -- This is discussed at: http://www.slipstick.com/outlook/ol2002/prftips.htm
IF "NO" <> READPROFILESTRING($winntfile,"General","BackupProfile")
$rc = WRITEPROFILESTRING($winntfile,"General","BackupProfile","NO")
ENDIF

; -- This is discussed at the bottom of - http://www.microsoft.com/office/ork/xp/four/outc03.htm
$rc=WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Setup","ImportPRF",$winntfile,"REG_SZ")

; -- Change the PRF file from %username% to @userid
IF @userid <> READPROFILESTRING($winntfile,"General","ProfileName")
$rc = WRITEPROFILESTRING($winntfile,"General","ProfileName",@userid)
ENDIF

RUN $exe+" /importprf "+$winntfile ; -- Import the profile for outlook

SLEEP 1

; -- Set the default mail preference as Rich Text format 1996609 is Word, 199610 Rich Text Format
IF "196610" <> READVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Options\Mail","EditorPreference")
$rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Options\Mail","EditorPreference","196610","REG_DWORD")
ENDIF

; -- Set the default Font to be Verdana 10 pt
$pltextfont = "3c0000000f0000e800000040c80000000600000000000000002056657264616e6100020000000000000000"
$pltextfont = $pltextfont + "0000000000201a493a38e9070001000000"
$rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Preferences","TextFontSimple",$pltextfont,"REG_BINARY")


; -- Changes the view to get rid of the Outlook Bar and show the "Explorer View"
IF $explorview = "Yes"
$expview = "010000002c0000000200000003000000ffffffffffffffffffffffffffffffff2c0000002c00000084"
$expview = $expview + "020000dc01000001000000000000000100000000000000c0000000640000001800000003000000"
$rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Office Explorer","Frame",$expview,"REG_BINARY")
ENDIF

; -- Check the box to empty deleted items on leaving Outlook - Now the we have the Outlook Profile Generated
IF $deleteitems = "Yes"
IF "1" <> READVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Preferences","EmptyTrash")
$rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Preferences","EmptyTrash","1","REG_DWORD")
ENDIF
ENDIF

RETURN
ENDSELECT
ENDIF

"Simplified" Version
code:
 BREAK ON
CLS
$profile_remove = "Yes" ; -- Profiles other than @USERID, like OEM User, MS Exchange Settings, etc. removed
$deleteitems = "Yes" ; -- Do you want your users to delete all deleted items on Exit from Outlook?

IF (@inwin = 1) ; -- Is it Winnt or 2K?
; -- Windows NT Registry Locations
$profilelocation = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
$windir = READVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion","SystemRoot")
ELSE
; -- Windows 9x Registry Locations
$profilelocation = "HKEY_CURRENT_USER\Software\Microsoft\Windows Messaging Subsystem\Profiles"
$windir = READVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion","SystemRoot")
ENDIF

$systemdrive = SUBSTR($windir,1,3) ; -- This will show C:\ or M:\ or what drive windows is installed on

; -- 19-August-2002 - Fixed detection problem, 0 = EXISTKEY with an OR Statment bombs on 3.63
;IF 0 = EXISTKEY($pprofilelocation) OR 0 = EXISTKEY($pprofilelocationf)
$ppru = $profilelocation+"\"+@userid
;$pprf = $profilelocation+"\"+@fullname
;IF (ExistKey($ppru) = 0) OR (ExistKey($pprf) = 0)
IF (ExistKey($ppru) = 0)
RETURN ; -- Profile exists and return
ELSE
$exe = ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE","")
$ver = GetFileVersion($exe) ; -- Get version of executable for MS-Outlook
$pos_locat = INSTR($ver, ".") - 1 ; - Look for where the dot is

$verchk = SubStr ($ver,1,$pos_locat)

IF 1 <> EXIST($windir+"\Outlook.PRF")
COPY @ldrive+"PROFGEN\RBMG\Outlook2000\Outlook.PRF" $windir
ENDIF
IF 1 <> EXIST ($windir+"\Profgen.exe")
COPY @ldrive+"PROFGEN\RBMG\Outlook2000\Profgen.exe" $windir
ENDIF
IF 1 <> EXIST ($windir+"\NEWPROF.EXE")
COPY @ldrive+"PROFGEN\RBMG\Outlook2000\NEWPROF.EXE" $windir
ENDIF
IF EXIST ($windir+"\FixPrf.EXE")
DEL $windir+"\FixPrf.EXE"
ENDIF
IF EXIST($systemdrive+"PROFGEN.exe")
DEL $systemdrive+"PROFGEN.EXE"
ENDIF
IF EXIST($systemdrive+"NEWPROF.EXE")
DEL $systemdrive+"NEWPROF.EXE"
ENDIF

SELECT
CASE
$verchk = "8" ; -- If it is Outlook 98, configure the following keys and values (e.g. 8.5.5104.0)
IF $profile_remove = "YES" ; -- If it does not exist, delete out any odd-ball Profiles
$index = 0
:loop3
$keyname = ENUMKEY($profilelocation, $index)
IF @error = 0
;? "Name found: $KeyName" ; -- Uncomment for debugging
IF $keyname <> @userid OR $keyname <> "Sales" ; -- Going to check for @userid
$rc = DELTREE($profilelocation+"\"+$keyname)
;$RC = DELKEY($ProfileLocation, $KeyName)
$index = $index + 1
GOTO Loop3
ENDIF
ENDIF
ENDIF
;$returncode= EXISTKEY($pprofilelocation) OR EXISTKEY($pprofilelocationf)
$returncode= EXISTKEY($ppru)
IF $returncode <> 0
; -- If you use RUN instead of SHELL, the script will pause and not complete properly
SHELL "%COMSPEC% /C "+$windir+"\Profgen.exe "+$windir+"\NEWPROF.EXE -P "+$windir+"\Outlook.PRF"
SLEEP 1
$rc = writevalue($profilelocation, "DefaultProfile", @userid, "REG_SZ")
ENDIF
RETURN
CASE
$verchk = "9" ; -- If it is Outlook 2000, configure the following keys and values (e.g. 9.0.0.2416)
IF $profile_remove = "YES" ; -- If it does not exist, delete out any odd-ball Profiles
$index = 0
:loop4
$keyname = ENUMKEY($profilelocation, $index)
IF @error = 0
;? "Name found: $KeyName" ; -- Uncomment for debugging
IF $keyname <> @userid OR $keyname <> "Sales" ; -- Going to check for @userid
$rc = DELTREE($profilelocation+"\"+$keyname)
;$RC = DELKEY($ProfileLocation, $KeyName)
$index = $index + 1
GOTO Loop4
ENDIF
ENDIF
ENDIF
; -- Generate the Inbox
; -- Make sure you use PUTINENV.EXE and WINSET.EXE with 9x machines - We need to have the %USERNAME% available

; -- If you use RUN instead of SHELL, the script will pause and not complete properly
SHELL "%COMSPEC% /C "+$windir+"\Profgen.exe "+$windir+"\NEWPROF.EXE -P "+$windir+"\Outlook.PRF"

; -- Had to add a small pause
SLEEP 1
$rc = writevalue($profilelocation, "DefaultProfile", @userid, "REG_SZ")

; -- Check for the Default profile, if it does not exist, create it
IF @userid <> READVALUE( $profilelocation, "DefaultProfile" )
$rc = WRITEVALUE ($profilelocation, "DefaultProfile", @userid, "REG_SZ")
ENDIF

; -- Check the box to empty deleted items on leaving Outlook - Now the we have the Outlook Profile Generated
IF $deleteitems = "Yes"
IF "0100" <> READVALUE($ppru+"\0a0d020000000000c000000000000046","000b0115")
$rc = WRITEVALUE($ppru+"\0a0d020000000000c000000000000046","000b0115","0100","REG_BINARY")
ENDIF
ENDIF
RETURN
CASE
$verchk = "10" ; -- If it is Outlook XP, configure the following keys and values
; -- No extra EXEs or files other than the PRF needed for Outlook XP
$winntfile = $windir+"\Outlook.PRF"

; -- This is discussed at: http://www.slipstick.com/outlook/ol2002/prftips.htm
IF "NO" <> READPROFILESTRING($winntfile,"General","BackupProfile")
$rc = WRITEPROFILESTRING($winntfile,"General","BackupProfile","NO")
ENDIF

; -- This is discussed at the bottom of - http://www.microsoft.com/office/ork/xp/four/outc03.htm
$rc=WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Setup","ImportPRF",$winntfile,"REG_SZ")

; -- Change the PRF file from %username% to @userid
IF @userid <> READPROFILESTRING($winntfile,"General","ProfileName")
$rc = WRITEPROFILESTRING($winntfile,"General","ProfileName",@userid)
ENDIF

RUN $exe+" /importprf "+$winntfile ; -- Import the profile for outlook

; -- Check the box to empty deleted items on leaving Outlook - Now the we have the Outlook Profile Generated
IF $deleteitems = "Yes"
IF "1" <> READVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Preferences","EmptyTrash")
$rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Preferences","EmptyTrash","1","REG_DWORD")
ENDIF
ENDIF

RETURN
ENDSELECT
ENDIF

Thanks,

Kent

[ 19. August 2002, 19:56: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's