Creating Outlook Profiles for RemoteApps

Posted by beakersoft | Posted in Enterprise | Posted on 15-08-2012

4


The Problem

Recently I have been involved in a project to roll out Microsoft RemoteApps, so users can launch applications on a terminal server via a website or shortcut. One of the issues we had was with a business application that was trying to send email out via Outlook.

The application was trying to open a new outlook email, but as outlook had never been launched before the application just hit an error as soon as it tried to send the email. I came across a few articles that pointed at adding a entry to the registry at HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\ImportPRF that contains a path to a prf file. When you set this path when Outlook first opens it will use this entry to create the profile based on the settings in the PRF file.

The problem I had was because Outlook was not actually being opened by the user, then the profile was never created, so they got an error. So in order to get around this, I decided to write a VB script that would create a Outlook object then launch the application. I would then use this as the application path in RemoteApp Manager to start the application.

The Solution

This is the script I wrote to launch my application:

Set objRegistry = CreateObject("Wscript.shell")
objRegistry.RegWrite "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\ImportPRF", "\\server\share\settings.prf", "REG_SZ"

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(6)
objRegistry.Run "%SYSTEMDRIVE%\Progam Files\App1\App1.exe"

So, what is the script doing. First of all we create a shell object so we can write to the registry. Then we write the key to point at our prf file (obviously you need to change this to your relevant path, and if you are not running Outlook 2010 the reg path will be different).

Now we have that setting in the reg, we create an object pointing at Outlook. As we do this Outlook essentially ‘runs’ and sets its self up based on the info in the prf. We then just shell out to the application we want to run, and an Outlook profile should be available for the application to use!

Comments (4)

Thank you! Made sense of the thought process I had regarding this and meant I could implement something for testing.

Such a simple concept but solves so many issues.

Hello

Thanks for the script, but i cant get it to work 100%.
The PRF imports, and outlook starts then closes, and then my remote app (Excel) starts correctly for the user.
Tho when i go to Save and Send and try to send my excel document to somone in our Org. it seems to work but the mail never sends, it justs get stuck in the outbox on the servers Outlook.
So when i log onto my Remote app server, start Outlook as the user that previously sent the Excel mail, the mail starts to send to its recipient.

Is there anyway to go around this?
I know that the feature outlook /minimized maybe would work? but if i run it via the VB script there wouldnt be anything that was checking for exit, so when i turn of my remote app (excel) Outlook will still be running in minimized mode or?

/Martin

@Martin – If you login to the terminal server desktop and run the script does it work? It sounds like there could be an issue with the prf file, or Outlook is maybe not importing the file, and creating a default profile that’s not actually got any of your exchange server settings in?

Hello

The PRF seems to work since Outlook gets all the info specified in the PRF file.
The problem has something to do with Remote app.

Its like, if i start my remote app, (excel in this case)
go to Archive save and send, the outlook window pops up, i can access the GAL and choose a recipient, when i press send the outlook window dissapears exactly as it should.
The reciepient tho never gets the mail.
And when i log on my Remote app server and start outook i can see the mail in Outbox, if i wait like 10 sec the mail sends to its recipient and i can se it in the sent items box.

We are running Outlook in Cached mode, maybe its there the problem is?

So the problem is that remote app just open a “session” to outlook and hasnt the rights to send.
Therefor if its possible i thougt of this:

Remote app Excel
First start Outlook /minimized
Start Excel
Save send should work
Close Excel
Close outlook (remote app session)

Write a comment

Comments links could be nofollow free.