Monday, January 22, 2007

CRM install failed with 'PST\ABP Install failed'

Before we started our CRM production enviroment, we did a lot of testing on CRM on TS/Citrix and we never got this error on any of our test users. I was kind of stumbed when I first got it on one of my production users.

First, let me talk a little about the log files of CRM client install. Every time a user runs the TS/Citrix CRM installation scripts, 2 log files are created/modified. If you are using Roaming Profiles, these files are located in the "Application data" folder of the user's Roaming Profile path (Check in Active Directory to get it, or ask your system administrator if you can't find them). The files are called 'Crm30ForOutlookInstaller.log' and 'TermInstall.log'. I may be a good starting point if some of your users are not getting CRM to work in Outlook.

Naturally I did a 'google' on the error message, however could not manage to resolve the error. I even tried 'Filemon' and 'Regmon' tools (www.sysinternals.com) to try and capture some file/registry access error, but no success. The 'TermInstall.log' file suggest that the error is due to that the user do not have a outlook profile configured. Further investigation revealed that this was not true. All users that have received this error have had a fully configured and working outlook profile.

To this day, I don't know why some of my users get this error, however the total number of users that get it is very low (5 of 300 users). The terminal server batch script that installes the CRM for the user, abort the installation when this error occures. To resolve it, we have to change the error handling of the batchscript so that the installation continues as it normally would. Please be adviced, this is not a supported solution, and I cannot be held responsible for any errors this might cause for your users. Anyhow, here it goes;

Locate the following section of the script:

:PstFound
@Echo ************************************************************************** >> %LOGFILE%
@Echo Executing Install PST Service And CRM ABP >> %LOGFILE%
%SOURCE%\CrmForOutlookTSInstaller.exe /logfile:%LOGFILEPATH% /installpst /pstname:%PSTNAME% /pstcomment:%PSTCOMMENT% /pstservicename:"MSPST MS" /targetpath:%PSTPATH% /installabp
IF ERRORLEVEL 1
( @Echo PST\ABP Install failed. It is likely that Outlook is not installed or not initialized. >> %LOGFILE% goto InstallError)

Notice the line that says "If ErrorLevel 1", well change that to "If ErrorLevel 2" and the installation will continue as normally.

Now, don't that just make your day complete??? :-)

Best of luck!

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: http://www.microsoft.com/downloads/details.aspx?familyid=664BEB55-1652-474F-AE06-C38DF171620E&displaylang=en.

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 =
\\yourdomain.ad\NETLOGON\CRM

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)
Else
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
Else
strEventViewer = strEventViewer &_
"Registry value 'HKCU\Software\Classes\crmaddin.Addin' is missing, " & _
"importing registry settings..." & VBCRLF
strCRMSetup = "
\\yourdomain.ad\NETLOGON\CRM"
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
Else
strEventViewer = strEventViewer & "Successfully running " & tmpCommand & vbCrLf
End if

End sub


Function RegKeyExists(strName)

Const NO_EXISTING_KEY = "HKEY_NO_EXISTING\Key\"
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
objWsh.RegRead NO_EXISTING_KEY
strNoKeyError = Err.Description
Err.Clear


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

RegKeyExists = False
Else
RegKeyExists = True
End If


Err.Clear

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:

\\yourdomain.ad\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.