Monday, January 22, 2007

Roaming profiles and CRM on TS/Citrix

Are you thinking about using CRM on Terminal servers/Citrix and is your organization using Roaming Profiles?

Microsoft says it is not officially supported, however there are ways around this. This also means that you can forget about calling Microsoft for support if you run in to any issues on your TS/Citrix server.

In our company, we use CRM 3.0 on Citrix PS 4.0 with roaming profiles. We only use published applications, not desktops. This reduces you "lockdown" issues regarding TS/Citrix server and at the same time, gives you the ability to restrict access to applications based on user/group membership in Active Directory.

For a complete guide to installing CRM on TS/Citrix, there is a superb guide on Microsoft:

And now the details on Roaming profile with CRM. The main issue is that when CRM is installed for the user, the installation script adds a lot of registry values for the user, and particularly in HKCU\Software\classes there are many entries. When the user logs off the TS/ICA session, the entries in HKCU\software\classes are not written to the users roaming profile. Hence the next time the user logs on and wants to use CRM, the CRM toolbar in Outlook is still there, but it may be “grayed out” or nothing happens when you click the toolbar buttons.

The best way to get those HKCU\Software\classes settings, is to run the installation script as a admin user on TS/Citrix and export those settings to a reg file. Then you can use this file and import the Classes when the user logs on to the TS/Citrix server. However you must import the settings before the user starts Outlook.

There are many ways you can accomplish this. We use a small VBS script that check certain registry settings, creates a outlook profile and import the classes before outlook is launched:

set oShell = CreateObject("Wscript.Shell")

strCRMSetup =

On Error Resume Next

If RegKeyExists("HKCU\Software\Microsoft\MSCRMClient\") = False then
strEventViewer = strEventViewer & "Running CRM install....." & VBCRLF

strCommand = strCRMSetup & "\terminstall.cmd install"
Call RunCommand (strCommand)
strEventViewer = strEventViewer & _

"Registry value 'HKCU\Software\Microsoft\MSCRMClient' exsist, skipping CRM install" & VBCRLF

If RegKeyExists("HKCU\Software\Classes\crmaddin.Addin\") = true then
strEventViewer = strEventViewer & _
"Registry value 'HKCU\Software\Classes\crmaddin.Addin' exsist" & VBCRLF
strEventViewer = strEventViewer &_
"Registry value 'HKCU\Software\Classes\crmaddin.Addin' is missing, " & _
"importing registry settings..." & VBCRLF
strCRMSetup = "
strCommand = strCRMSetup & "\regOutAddIn.cmd"
Call RunCommand (strCommand)
End if
End if

strEventViewer = strEventViewer & "Starting outlook.exe....."

oShell.Run """N:\Prog\Microsoft Office\OFFICE11\outlook.exe"""

oShell.LogEvent 0, strEventViewer & err.description

set oShell = Nothing

'Subrutines here

SUB RunCommand (tmpCommand)
On error resume next
cmdRun = oShell.Run(tmpCommand,7,"True")
If cmdRun <> 0 then
strEventViewer = strEventViewer & "Failure running " & tmpCommand & vbCrLf
strEventViewer = strEventViewer & "Successfully running " & tmpCommand & vbCrLf
End if

End sub

Function RegKeyExists(strName)

Dim objWsh, strKeyPath, strNoKeyError

Set objWsh = WScript.CreateObject("WScript.Shell")

strKeyPath = Trim(strName)

If Right(strKeyPath, 1) <> "\" Then strKeyPath = strKeyPath & "\"

On Error Resume Next

' Get the error description by trying to read a non-existent key
strNoKeyError = Err.Description

objWsh.RegRead strKeyPath
' Compare the error description with the previous determined sample
If Replace(Err.Description, strKeyPath, NO_EXISTING_KEY) = strNoKeyError Then

RegKeyExists = False
RegKeyExists = True
End If


On Error Goto 0

Set objWsh = Nothing

End Function

Now what about that 'regOutAddIn.cmd' file I am referring to in my script. Well that is quite simple, it contains one line of code:

\\\netlogon\regedit.exe /s crmclasses.reg

Remember I said you should export the registry settings for HKCU\Software\Classes, well that export is the crmclasses.reg file. Now don't forget to also copy regedit.exe to the location where the crmclasses.reg file is located.

No comments: