Current script (using call outs to dos scripts for reg / folder changes):

 Code:
SetConsole('SHOW')
;
; Declaring Global Variables
;
DIM $Selection ;Used to determine the button pressed by the user.
DIM $FILE1 ; OutlookRan.txt check file
DIM $PATH1 ; Path to Outlook folder on psroot
DIM $DEFAULTS ; script that inserts default outlook profile settings
DIM $REGEXPORTS ; script for registry exports
DIM $DELETE ; script for deleteing data we don't need
;
$Rc = SetOption('NoVarsInStrings', 'On')
$Rc = SetOption('NoMacrosInStrings', 'On')
;
; Specify File and Path Variables
;
$FILE1 = 'c:\Scripts\OutlookRan.txt'
$PATH1 = '\\netshare\userconfigs$\' + @userid + '\PSCitrixConfig\Outlook'
;
; Specify additional script variables
;
$DEFAULTS = 'c:\scripts\apphelpscripts\defaults.cmd'
$REGEXPORTS = 'c:\scripts\apphelpscripts\regexports.cmd'
$DELETE = 'c:\scripts\apphelpscripts\delete.cmd'
;
; Provide the user a popup message asking them if they want to proceed with this script or to exit.
;
$Selection = MessageBox ("This will rebuild your Outlook profile, Do you wish to continue? Press YES to rebuild your outlook profile, or press NO to cancel", "                                      Rebuild Outlook profile on Launchpad servers", 36) 
If $Selection = 6
		; Now we're going to start deleteing data
		MessageBox ("Once you click OK on this message the Outlook reset process will start. Please wait until you see another message informing you the rebuild has completed before using any office applications..", "                  Outlook profile rebuild on PS Launchpad servers started.....", 0, 10)
		SHELL '%comspec% /c taskkill.exe /IM "outlook.exe" /F /T'
		SHELL '%comspec% /c taskkill.exe /IM "ObClnt32.exe" /F /T'
		SHELL '%comspec% /c taskkill.exe /IM "obunity.exe" /F /T'
		Sleep 5 
		RUN $DELETE
		Sleep 5 ; script paused for 5 seconds, after the pause we re-add default data, and launch Outlook
		Run $DEFAULTS
		SLEEP 13 ; Pausing to let outlook sort out it's profile, next we kill Outlook. 
		SHELL '%comspec% /c taskkill.exe /IM "outlook.exe" /F /T'
		SHELL '%comspec% /c taskkill.exe /IM "ObClnt32.exe" /F /T'
		SHELL '%comspec% /c taskkill.exe /IM "obunity.exe" /F /T'
		SLEEP 5 ; Pause a moment to let Outlook close and clean up, then we copy our correct outlook profile settings out to our network share for safe keeping
		COPY $FILE1 $PATH1 
		RUN $REGEXPORTS
		SLEEP 5 ; Last pause before our final message box.
		MessageBox ("Your Outlook profile has been Rebuilt, and your e-mail should now work properly. If you continue to have problems with using Outlook, please open a Helpdesk or contact extention 2500.", "                           Outlook Profile Rebuild Completed!", 0, 10)
	ELSE
		EXIT
ENDIF
EXIT
	


Content of DELETE.cmd:

 Code:
@echo off
c:
cd\

Del "\\netshare\userconfigs$\%username%\PSCitrixconfig\Outlook\Outlookran.txt" /q
Del "\\netshare\userconfigs$\%username%\PSCitrixconfig\Outlook\Outlookmessaging.reg" /q
Del "\\netshare\userconfigs$\%username%\PSCitrixconfig\Outlook\Office.reg" /q
Reg Delete "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem" /va /f
Reg Delete "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup" /v FirstRun /f
Reg Delete "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup" /v First-Run /f
Reg Delete "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup" /v ImportPRF /f
RD "c:\users\%username%\Appdata\Local\Microsoft\Outlook" /S /Q
RD "C:\users\%username%\Appdata\Roaming\Microsoft\Outlook" /S /Q

exit


Content of Defaults.cmd:

 Code:
@echo off

MD "c:\users\%username%\Appdata\local\Microsoft\Outlook"
MD "c:\users\%username%\Appdata\Roaming\Microsoft\Outlook"

Reg Add "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup" /v FirstRun /t Reg_dword /d 0
Reg Add "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup" /v First-Run /t Reg_dword /d 0
Reg Add "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup" /v ImportPRF /t Reg_Sz /d "c:\Progra~2\Micros~2\Custom14.prf"

Timeout /T 2 /NOBREAK

Start Ctxhide.exe "C:\Program Files (x86)\Microsoft office\office14\Outlook.exe"

Exit


While on the one hand I'm happy to have a solution that works as I want it to. On the other hand I'd like to understand what I'm doing wrong (if anything) with my kix scripting to make the application behave differently.

Lan