#207326 - 2013-05-17 08:31 PM
Bit of an odd issue
|
Tsguy
Getting the hang of it
Registered: 2010-01-18
Posts: 67
Loc: Oregon
|
Hello kixers,
Kind of a long story on this issue but I'll try and keep it short. We have a hosted application on our terminal servers that requires an Outlook profile for users in order to allow them to e-mail. We have for a long time maintained a scripted process that would launch outlook in the background for new users in order to setup their outlook profile for their session, and we'd then save that profile info to the network for use with other apps.
Every so often, this process breaks down, and a users outlook profile on the TS servers gets messed up. To correct this, the administrators need to delete a few files, and ask the user to re-run their app.
I am looking to automate this Outlook profile default process for our administrators and our users.
My first effort at this was 3 scripts.
1) CMD script that called to a kix script 2) kix script provided a messagebox, and with the proper selections would RUN the third CMD scirpt 3) CMD script would do all the dirty work, delete and recreate values to reset the outlook profile.
This whole setup worked very well. What I was unable to get to work to my liking was messaging. I wanted message boxes to occur a specific intervals in the script, and couldn't get the timing right (either they'd not show up at all, or they'd all show up at once).
The more I tinkered, the more complex the script became, and the less it functioned. So I decided to backup and recreate the whole project in Kix.
I have been able to get everything to work as I want in Kix, except for one rather bizarre issue. Within the script, after the recreation of Outlook directory and registry values, I place a call to launch outlook. When this occurs in my CMD script version of this project, outlook launches directly into the Inbox . .no profile setup prompts with "next" etc. The very same commands from my kix script . . get the Outlook profile setup window prompts.
I have debug'd my code, and haven't been able to sort out where the break down is. Posting my original "CMD" scipt, and my KIX script. Suggestions greatly appreciated:
CMD script to reset outlook profile to defaults:
@echo off
REM * This script's purpose is to delete and recreate all components of a user's mail profile *
REM
REM * This script is only intended to be run for repairing outlook on the terminal servers *
REM
REM We start with closing outlook processes if they are still running.
taskkill /IM ObClnt32.exe /F
taskkill /IM Outlook.exe /F
taskkill /IM CTFMON.exe /F
taskkill /IM obunity.exe /F
REM Lets pause for a few moments to make sure everything is closed
Timeout /T 5 /NOBREAK
REM Now we're going to delete the current Office settings for our user.
REM First we'll delete the data saved to the network.
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
REM second we delete the local data
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
REM now that all data has been purged, lets pause again to catch our breath.
Timeout /T 5 /NOBREAK
REM Now we recreate profile folders and insert the default Outlook startup registry values
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"
REM In theory our settings have been defaulted, now lets try launching Outlook.
Timeout /T 5 /NOBREAK
Start Ctxhide.exe "C:\Program Files (x86)\Microsoft office\office14\Outlook.exe"
Xcopy "C:\scripts\Outlookran.txt" "\\netshare\userconfigs$\%username%\PsCitrixConfig\Outlook" /Y
Timeout /T 5 /NOBREAK
taskkill /IM Outlook.exe /F
taskkill /IM CTFMON.exe /F
regedit /E "\\netshare\userconfigs$\%username%\PsCitrixConfig\Outlook\Outlookmessaging.reg" "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem"
regedit /E "\\netshare\userconfigs$\%username%\PsCitrixConfig\Outlook\Office.reg" "HKEY_CURRENT_USER\Software\Microsoft\Office"
Timeout /t 5 /NOBREAK
c:
cd\
exit
And the KIX version of this project (this script calls out to a few CMD files that perform tasks I couldn't get kix to do in debug will try and flesh each of those out as best I can):
SetConsole('SHOW')
;
; Declaring Global Variables
;
DIM $Selection ;Used to determine the button pressed by the user.
DIM $FILE1 ; OutlookRan.txt on netshare share
DIM $FILE2 ; OutlookMessaging.reg on netshare share
DIM $FILE3 ; Office.reg on netshare share
DIM $FILE4 ; Default PRF file for profile setup
DIM $FILE5 ; OutlookRan.txt check file
DIM $PATH1 ; Path to Outlook folder on netshare
DIM $PATH2 ; Local Appdata path to Outlook settings
DIM $PATH3 ; Roaming Appdata path to Outlook settings
DIM $REGPATH1 ; Registry key path to Windows Messaging subsystem
DIM $REGPATH2 ; Registry key path to FirstRun Setup key
DIM $REGPATH3 ; Registry key path to First-Run Setup key
DIM $REGPATH4 ; Registry key path to ImportPRF Setup key
DIM $APP ; The EXE we want to run
DIM $KILLAPP1 ; script that makes sure Outlook is not running
DIM $REGEXPORTS ; script for registry exports
;
$Rc = SetOption('NoVarsInString', 'On')
$Rc = SetOption('NoMacrosInString', 'On')
;
; Specify File and Path Variables
;
$FILE1 = '\\netshare\userconfigs$\' + @userid + '\PsCitrixConfig\Outlook\Outlookran.txt'
$FILE2 = '\\netshare\userconfigs$\' + @userid + '\PSCitrixConfig\Outlook\OutlookMessaging.reg'
$FILE3 = '\\netshare\userconfigs$\' + @userid + '\PSCitrixConfig\Outlook\Office.reg'
$FILE4 = 'c:\Progra~2\Micros~2\Custom14.prf'
$FILE5 = 'c:\Scripts\OutlookRan.txt'
$PATH1 = '\\netshare\userconfigs$\' + @userid + '\PSCitrixConfig\Outlook'
$PATH2 = 'c:\users\' + @userid + '\Appdata\Local\Microsoft\Outlook'
$PATH3 = 'c:\users\' + @userid + '\Appdata\Roaming\Microsoft\Outlook'
;
; Specify Registry Path Variables
;
$REGPATH1 = 'HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem'
$REGPATH2 = 'HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Setup'
$REGPATH3 = 'HKEY_CURRENT_USER\Software\Microsoft\Office'
;
; Specify application variables
;
$APP = 'C:\scripts\Apphelpscripts\LaunchOutlook.cmd'
;
; Specify additional script variables
;
$KILLAPP1 = 'c:\scripts\apphelpscripts\taskkilloutlook.cmd'
$REGEXPORTS = 'c:\scripts\apphelpscripts\regexports.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", 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 started.....", 0, 10)
RUN $KILLAPP1
Sleep 5
DELTREE ($REGPATH1)
DELVALUE ($REGPATH2, "FirstRun")
DELVALUE ($REGPATH2, "First-Run")
DELVALUE ($REGPATH2, "ImportPRF")
DEL $FILE1 /c
DEL $FILE2 /c
DEL $FILE3 /c
SHELL '%comspec% /c RD $PATH2 /S /Q'
SHELL '%comspec% /c RD $PATH3 /S /Q'
Sleep 5 ; script paused for 5 seconds, after the pause we start re-adding default data
MD $PATH2
MD $PATH3
WriteValue ($REGPATH2, "FirstRun", "0", "REG_DWORD")
WriteValue ($REGPATH2, "First-Run", "0", "REG_DWORD")
WriteValue ($REGPATH2, "ImportPRF", $FILE4, "REG_SZ")
SLEEP 5 ; Now we're going to start outlook up
RUN $APP
SLEEP 10 ; Pausing the let outlook sort out it's profile, next we kill Outlook.
RUN $KILLAPP1
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 $FILE5 $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
There are 3 calls currently within the kix script to other scripts to perform functions I was unable to get working with Kix coding directly.
1) Taskkill, for some reason this wasn't working for me properly from kix, so I put it in CMD and it works fine. This is the command I was originally trying to run, before I placed a call to a CMD file as a replacement.
shell '%comspec% /c Taskkill /IM outlook.exe /F'
2) Starting Outlook. Originally I just did the code below, when that didn't work I tried calling out to a CMD file that runs the same command as my original script:
$APP = 'c:\program files (x86)\Microsoft\Office\Outlook.exe'
RUN $App
3) Registry exports. This function I also started with a shell reference but the exports never occured, so again, I dropped to running a CMD file that exports no problem. Kix code attempted:
shell '%compspec% /c Reg Export $REGPATH3 $FILE3'
Well I kinda tried to keep it short ;). The meat of this process is the deletion of 3 reg values and 1 reg key under HKCU, along with the deletion of 2 folders under the user profile. By having the "firstrun" keys setup in the right spot in the registry for outlook, along w/ a PRF file pointer, outlook will 'auto' build it's profile when users start it.
Aside from the language differences, I can't sort out why I'm having different results with launching outlook after the scripts are run. Thoughts?
Much thanks for reading thru all this 
-Lan
PS - my kix build version = 4.62.0.0
|
|
Top
|
|
|
|
#207327 - 2013-05-17 09:40 PM
Re: Bit of an odd issue
[Re: Tsguy]
|
ShaneEP
MM club member
   
Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
|
Well since you are turning on the NoVarsInString option at the start, there are more than one command you are trying that still has variables in strings...These would not work.
I modified your script a little bit, you can give it a try and see what happens. It is all in kix and should work.
$Rc = SetOption('NoVarsInString', 'On')
$Rc = SetOption('NoMacrosInString', 'On')
$RC = SetConsole('SHOW')
; Declaring Global Variables
DIM $FILE1 ; OutlookRan.txt on netshare share
DIM $FILE2 ; OutlookMessaging.reg on netshare share
DIM $FILE3 ; Office.reg on netshare share
DIM $FILE4 ; Default PRF file for profile setup
DIM $FILE5 ; OutlookRan.txt check file
DIM $PATH1 ; Path to Outlook folder on netshare
DIM $PATH2 ; Local Appdata path to Outlook settings
DIM $PATH3 ; Roaming Appdata path to Outlook settings
DIM $REGPATH1 ; Registry key path to Windows Messaging subsystem
DIM $REGPATH2 ; Registry key path to FirstRun Setup key
DIM $REGPATH3 ; Registry key path to First-Run Setup key
DIM $REGPATH4 ; Registry key path to ImportPRF Setup key
DIM $APP ; The EXE we want to run
DIM $KILLAPP1 ; script that makes sure Outlook is not running
DIM $REGEXPORTS ; script for registry exports
; Specify File and Path Variables
$FILE1 = '\\netshare\userconfigs$\' + @userid + '\PsCitrixConfig\Outlook\Outlookran.txt'
$FILE2 = '\\netshare\userconfigs$\' + @userid + '\PSCitrixConfig\Outlook\OutlookMessaging.reg'
$FILE3 = '\\netshare\userconfigs$\' + @userid + '\PSCitrixConfig\Outlook\Office.reg'
$FILE4 = 'c:\Progra~2\Micros~2\Custom14.prf'
$FILE5 = 'c:\Scripts\OutlookRan.txt'
$PATH1 = '\\netshare\userconfigs$\' + @userid + '\PSCitrixConfig\Outlook'
$PATH2 = 'c:\users\' + @userid + '\Appdata\Local\Microsoft\Outlook'
$PATH3 = 'c:\users\' + @userid + '\Appdata\Roaming\Microsoft\Outlook'
; Specify Registry Path Variables
$REGPATH1 = 'HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem'
$REGPATH2 = 'HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Setup'
$REGPATH3 = 'HKEY_CURRENT_USER\Software\Microsoft\Office'
; Provide the user a popup message asking them if they want to proceed with this script or to exit.
If 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", 36) = 6
; Now we're going to start deleteing data
$RC = 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 started.....", 0, 10)
SHELL '%comspec% /c taskkill.exe /IM "outlook.exe" /F /T'
$RC = DELTREE($REGPATH1)
$RC = DELVALUE($REGPATH2, "FirstRun")
$RC = DELVALUE($REGPATH2, "First-Run")
$RC = DELVALUE($REGPATH2, "ImportPRF")
DEL $FILE1 /c
DEL $FILE2 /c
DEL $FILE3 /c
RD $PATH2 /S
RD $PATH3 /S
While (Exist($PATH2) OR Exist($PATH3)) Loop
MD $PATH2
MD $PATH3
$RC = WriteValue($REGPATH2, "FirstRun", "0", "REG_DWORD")
$RC = WriteValue($REGPATH2, "First-Run", "0", "REG_DWORD")
$RC = WriteValue($REGPATH2, "ImportPRF", $FILE4, "REG_SZ")
RUN "%ProgramFiles%\Microsoft\Office\Outlook.exe"
SLEEP 10 ; Pausing the let outlook sort out it's profile, next we kill Outlook.
SHELL '%comspec% /c taskkill.exe /IM "outlook.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 $FILE5 $PATH1
SHELL '%compspec% /c Reg Export "'+$REGPATH3+'" "'+$FILE3+'"'
SLEEP 5 ; Last pause before our final message box.
$RC = 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)
ENDIF
EXIT
Edited by ShaneEP (2013-05-17 11:40 PM) Edit Reason: error in taskkill commands
|
|
Top
|
|
|
|
#207329 - 2013-05-17 10:29 PM
Re: Bit of an odd issue
[Re: Tsguy]
|
Tsguy
Getting the hang of it
Registered: 2010-01-18
Posts: 67
Loc: Oregon
|
As an example the helps confuse me . . with Novarsinstring=ON, I would bet this is a statement that "shouldn't" work, but it most certainly does.
SHELL '%comspec% /c RD $PATH2 /S /Q'
I had wanted to try RD from kix, but the manual indicated the folders needed to be empty for it to work, and they are not.
Should this also work?
SHELL '%comspec% /c RD "'+$PATH2+'" /S /Q'
|
|
Top
|
|
|
|
#207331 - 2013-05-17 10:34 PM
Re: Bit of an odd issue
[Re: ShaneEP]
|
ShaneEP
MM club member
   
Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
|
And as for the novarsinstrings, try this simple example. You will see that with the option set to ON, notepad does not launch as expected. Whereas if you comment out the first line and try again, it launches fine.
$nul = SetOption("NoVarsInStrings","On")
$PATH2 = "notepad.exe"
SHELL '%comspec% /c $PATH2'
|
|
Top
|
|
|
|
#207332 - 2013-05-17 10:46 PM
Re: Bit of an odd issue
[Re: ShaneEP]
|
Tsguy
Getting the hang of it
Registered: 2010-01-18
Posts: 67
Loc: Oregon
|
Well . . I had thought I had stumbled across some new problem with kix, because all my tests were launching notepad.exe no problems.
Then I realized that I was setting the "NoVarsInString" option, as opposed to the "NoVarsInStringS" option....
/sigh.
Thanks again Shane
|
|
Top
|
|
|
|
#207334 - 2013-05-17 11:27 PM
Re: Bit of an odd issue
[Re: ShaneEP]
|
Tsguy
Getting the hang of it
Registered: 2010-01-18
Posts: 67
Loc: Oregon
|
Well ok, have spent more time working on this, and still have the same issue, also sorted out a minor syntax issue with your posted script Shane.
You provided this as a correction, but it doesn't run as is:
SHELL '%comspec% /c taskkill.exe /IM /F /T "outlook.exe"'
When you define the /IM switch you need to follow it up with the exe name ;), so:
SHELL '%comspec% /c taskkill.exe /IM "outlook.exe" /F /T'
works just fine though.
Here's my major problem with this script so far, and the part that's frankly wierding me a out a bit. If I remove all registry and file manipulation from this kix script directly, and instead place calls out to CMD scripts to delete / add data to the registry, and delete / create folders and files. Then when I call to launch outlook . . it opens up right into the Inbox. (which is what I want).
If I continue to try to use Kix to do registry and file / folder manipulation in this script, then when I place a call to outlook to launch, it will start @ the profile setup screen (forcing the user to select next 3 times to complete their profile setup).
It's bizarre . .kix is doing all the right things, creating all the right registry keys, and folders, but Outlook is behaving differently and I'm unsure why. Perhaps the permissions on the regkeys or the folders created by kix are off? I will see if I can confirm that...
I will post my heavily modify kix script in a few minutes (basically rem'd out much of the path / reg variables).
Lan
|
|
Top
|
|
|
|
#207335 - 2013-05-17 11:41 PM
Re: Bit of an odd issue
[Re: Tsguy]
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4567
Loc: USA
|
|
|
Top
|
|
|
|
#207336 - 2013-05-17 11:42 PM
Re: Bit of an odd issue
[Re: Tsguy]
|
Tsguy
Getting the hang of it
Registered: 2010-01-18
Posts: 67
Loc: Oregon
|
Current script (using call outs to dos scripts for reg / folder changes):
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:
@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:
@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
|
|
Top
|
|
|
|
#207344 - 2013-05-18 05:20 PM
Re: Bit of an odd issue
[Re: Tsguy]
|
ShaneEP
MM club member
   
Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
|
Just for giggles, try adding this to the top of the script.
$RC = SetOption("WOW64AlternateRegView","On")
Just to rule out it's not a weird Win64 registry redirection thats causing the problem.
|
|
Top
|
|
|
|
#207345 - 2013-05-18 06:19 PM
Re: Bit of an odd issue
[Re: ShaneEP]
|
ShaneEP
MM club member
   
Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
|
Here is the entire script in all Kix, I wish I had a system that used outlook that I could test on but I don't. I only have one question left about the script...
What does this "c:\Progra~2\Micros~2\Custom14.prf" point to? I would definitely change this to the full directory. Other than that everything 'should' work. If it still launches differently then there has to be a registry key, or file that is not being written/deleted as it should be.
$RC = SetOption("WOW64AlternateRegView","On")
$Rc = SetOption('NoVarsInStrings', 'On')
$Rc = SetOption('NoMacrosInStrings', 'On')
$RC = SetConsole('SHOW')
; Provide the user a popup message asking them if they want to proceed with this script or to exit.
If 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) = 6
; Now we're going to start deleteing data
$RC = 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)
$RC = EnumProcess("outlook.exe",1)
$RC = EnumProcess("ObClnt32.exe",1)
$RC = EnumProcess("obunity.exe",1)
DEL "\\netshare\userconfigs$\"+@userid+"\PsCitrixConfig\Outlook\Outlookran.txt" /c
DEL "\\netshare\userconfigs$\"+@userid+"\PSCitrixConfig\Outlook\OutlookMessaging.reg" /c
DEL "\\netshare\userconfigs$\"+@userid+"\PSCitrixConfig\Outlook\Office.reg" /c
$RC = DELTREE("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem")
$RC = DELVALUE("HKCU\Software\Microsoft\Office\14.0\Outlook\Setup", "FirstRun")
$RC = DELVALUE("HKCU\Software\Microsoft\Office\14.0\Outlook\Setup", "First-Run")
$RC = DELVALUE("HKCU\Software\Microsoft\Office\14.0\Outlook\Setup", "ImportPRF")
RD "%userprofile%\Appdata\Local\Microsoft\Outlook" /s
RD "%userprofile%\Appdata\Roaming\Microsoft\Outlook" /s
MD "%userprofile%\Appdata\Local\Microsoft\Outlook"
MD "%userprofile%\Appdata\Roaming\Microsoft\Outlook"
$RC = WriteValue("HKCU\Software\Microsoft\Office\14.0\Outlook\Setup", "FirstRun", "0", "REG_DWORD")
$RC = WriteValue("HKCU\Software\Microsoft\Office\14.0\Outlook\Setup", "First-Run", "0", "REG_DWORD")
$RC = WriteValue("HKCU\Software\Microsoft\Office\14.0\Outlook\Setup", "ImportPRF", "c:\Progra~2\Micros~2\Custom14.prf", "REG_SZ")
Run "%ProgramFiles%\Microsoft\Office\Outlook.exe"
SLEEP 13
$RC = EnumProcess("outlook.exe",1)
$RC = EnumProcess("ObClnt32.exe",1)
$RC = EnumProcess("obunity.exe",1)
COPY "c:\Scripts\OutlookRan.txt" "\\netshare\userconfigs$\"+@userid+"\PSCitrixConfig\Outlook"
SHELL '%comspec% /c Reg Export "HKCU\Software\Microsoft\Office" "\\netshare\userconfigs$\'+@userid+'\PSCitrixConfig\Outlook\Office.reg"'
$RC = 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)
ENDIF
EXIT 0
FUNCTION EnumProcess($exe, optional $terminate, optional $Computer)
Dim $winmgmts, $ExecQuery, $Process, $id, $getobject, $
If NOT $computer
$computer = @wksta
Endif
$winmgmts="winmgmts:{impersonationLevel=impersonate}!//$COMPUTER"
Select
Case val($exe)>0
$ExecQuery="select * from Win32_Process where ProcessId='$exe'"
$GetObject=GetObject($winmgmts).ExecQuery($ExecQuery)
For Each $Process in $GetObject
If $terminate
$ = $Process.Terminate
Endif
$EnumProcess = $Process.name
Next
$GetObject=''
Case vartype($exe)=8
$ExecQuery="select * from Win32_Process where Name='$exe'"
$GetObject=GetObject($winmgmts).ExecQuery($ExecQuery)
For Each $Process in $GetObject
If $terminate
$=$Process.Terminate
Endif
$id=$Process.ProcessId
$EnumProcess = "$Id" + "|" + "$EnumProcess"
Next
$EnumProcess=left($EnumProcess,len($EnumProcess)-1)
$GetObject=''
Case 1
Exit 1
EndSelect
ENDFUNCTION
Edited by ShaneEP (2013-05-18 08:51 PM)
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1077 anonymous users online.
|
|
|