Link to home
Start Free TrialLog in
Avatar of EllsworthAdhesives
EllsworthAdhesives

asked on

Import Reg Files prior to Launching Citrix (pub'd app)

I'd like to be able to launch .reg files for end-users (to change settings in their Outlook) from Citrix PS 4.0.  I imagine that I can call a batch file someway (start, call, etc) -- from a published app and then have that batch file not only import the registry items, but then to also launch Outlook.

So what I'd like to know is my syntax for calling this batch file?

And then inside the batch file I'd like to know if the following is the correct syntax?

   start /wait REGEDIT /s "q:\regs\outlook2003-nod.reg"
   call "q:\Program Files\Microsoft Office\OFFICE11\outlook.exe"

Now oddly enough when I launch the batch file along, it works -- but the problem is that the regedit doesn't seem to actually import.   What I'm trying to do is to shutoff things like the Desktop Alert.  So the reg file says:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Preferences]
"AllowCommasInRecip"=dword:00000000
"PlaySound"=dword:00000000
"ShowEnvelope"=dword:00000000
"ChangePointer"=dword:00000000
"NewmailDesktopAlerts"=dword:00000000

If I launch the REG file it imports fine, but if I launch this as a batch file (silent with the /s from the batch file) - it does not import -- because if I load Outlook it does not revert my settings.
Avatar of BLipman
BLipman
Flag of United States of America image

Instead of changing the parameters of the published application, I would use a targeted logon script.  You can use group policy to enable this and call a command file to modify the user registries.  Another approach (might be too late) is to use the Default User profile.  Set up a standard user to test and set your Office config to how you like it (merge in any reg files that affect HKCU manually).  Now log the user off and overwrite the NTUser.dat for Default User with your modified one (from your test user).
Now when a new person logs in they get a modified HKCU per your changes.  You would need to delete any profiles currently on the server to get the users to take the new registry.  
Otherwise, I would use gpo to launch my script for reg merges and publish Outlook normally.  
Avatar of EllsworthAdhesives
EllsworthAdhesives

ASKER

Sorry BLipman -- that's not what I was desiring, nor what I asked.

However, I actually figured it out myself and wanted to share it.

One can use the [HKEY_CURRENT_USER\...] and import commands using the "REG ADD" command at anytime.  This makes for an easy way to change any settings for users on the fly.  I suggest the use of Advanced Registry Tracer (http://www.elcomsoft.com/art.html) to determine the registry keys to use.  Simply launch an ART scan beforehand, launch then any applications and make the necessary changes, then re-run ART.  This will show you the changes, and allow you to jump to REGEDIT where you can export the keys (edit them in notepad to pull out additional keys you do not want for later importing).

Then publish your app as normal, then go back and change the Location to be CSCRIPT OUTLOOKSTART.VBS.  Changing the location after publishing, is required only to keep the current icon file -- publish this from the beginning and you get a different icon.  

OutlookStart.vbs is a simply a script that calls a batch file (this minimizes the opening of any DOS windows):

-------------------------------
Set oShell = CreateObject ("Wscript.Shell")
sCmd = "q:\regs\outlook2003-start.cmd"

'The 0 will make it run hidden
oShell.Run sCmd, 0, True
-------------------------------

This calls outlook2003-start.cmd which contains:
-------------------------------
echo off
cls
echo LAUNCHING OUTLOOK 2003
reg import "q:\regs\outlook2003-nod.reg"
call "q:\Program Files\Microsoft Office\OFFICE11\outlook.exe"
exit
-------------------------------

And OUTLOOK2003-NOD.REG contains:
-------------------------------
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Preferences]
"AllowCommasInRecip"=dword:00000000
"PlaySound"=dword:00000000
"ShowEnvelope"=dword:00000000
"ChangePointer"=dword:00000000
"NewmailDesktopAlerts"=dword:00000000
------------------------------

Thus, you don't have to deal with anyone's profile, you don't deal with anyone's GPO, etc.  And you get precisely what you want every-time.  Furthermore, you could also setup the batch file that's called to parse through Windows or ActiveDirectory Group inclusions and apply or not apply particular settings based on memberships.
Hey, congrats BLipman - I see you just got Citrix Master Certified!  The 4th!

-gsgi
Thx gsgi!
ASKER CERTIFIED SOLUTION
Avatar of Netminder
Netminder

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial