I think we can clean up (simplify?) the script with the follwoing (no SHELL needed for COPY, and no GOTO/GOSUBS) -
code:
 ;SetConsole ('HIDE')
;
? '** Starting Automatic MS Outlook Profile Generation...'
? '** Checking if Outlook is installed...'
IF Exist ('c:\program files\microsoft office\office10\outlook.exe')
? '** Checking if outlook userprofile exists...'
IF 0=Exist('%userprofile%\application data\microsoft\outlook\'+@USERID+'.fav')
$rc = WriteValue('HKCU\Software\Microsoft\Office\10.0\Outlook\setup','ImportPRF',@HOMESHR+'\outlook.prf','REG_SZ')
? '** Copying Default Outlook Profile...'
SELECT
CASE
Ucase(@homeshr)='\\NT1\USERS'
COPY @ldrive+'olp_rot_xp.prf' '%windir%\outlook.prf'
CASE
Ucase(@homeshr)='\\AMSSVR01\USERS'
COPY @ldrive+'olp_ams_xp.prf' '%windir%\outlook.prf'
ENDSELECT
? '** Creating new Outlook profile based on current user...'
SHELL '%COMSPEC% /E:1024 /C ' + @ldrive + 'prfpatch.exe'

SELECT
CASE
Ucase(@homeshr)='\\NT1\USERS'
COPY $source+'\outlook.prf' '\\NT1\users\'+@userid
CASE
Ucase(@homeshr)='\\AMSSVR01\USERS'
COPY $source+'\outlook.prf' '\\AMSSVR01\users\'+@userid
ENDSELECT
$rc = WriteValue('HKCU\Software\Microsoft\Office\10.0\Outlook\setup','ImportPRF',@homeshr+'\outlook.prf','REG_SZ')
ELSE
? '** Outlook profile found... skipping to end of script...'
RETURN
ENDIF
ELSE
? '** Outlook is NOT installed,skipping to end of script...'
RETURN
ENDIF

I still think we can incorporate the changes that Anthony Harper was kind enough to provide will help too.. If you look at my code re-write, it does this "compartmentalized" or using functions to do this. Sure, it is more extensive or has more code, but covers the needs. [Smile]

HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's