image When you upgrade a computer that is running the App-V 4.5 client to System Center Configuration Manager 2007 SP2, it may break all the File Type Associations (FTA's) for the virtualized applications.  This can occur because the SP2 installer updates the following key in the registry as part of the Configuration Manager 2007 Service Pack 2 upgrade:

HKEY_CLASSES_ROOT\SCCM.VAppLauncher\shell\Open\command

But it does not update the other two keys that App-V uses:

HKLM\SOFTWARE\Microsoft\SoftGrid\4.5\Client\UserInterface - DDELaunchMSICommand and LaunchMSICommand

This causes all the FTAs that were created through a published APP-V application to break, until a time when a new application is published to the machine which triggers the client to update the key itself.  At this point the FTAs for the newly published app would work but the FTAs for all other already existing apps would still be broken.

Resolution

If you publish an application that has FTAs to a client then it will force an update of the previously mentioned key in the registry.  The problem with this is that the application only reads that registry key on startup so the newly published application will be fixed but none of the others.  To fix all of the other applications you would need to restart the App-V client machine after publishing a new app.

Instead of re-publishing an app, I have created the following script that will update those registry keys without requiring you to re-publish an application. Note that you will need to restart the computer after running the script for the fix to take effect.  This can be done manually or automated via a script or management system, etc.

Here is the code of the Visual Basic script:

==========================

On Error Resume Next

'Script Name: App-V_Client_Fix.vbs
'Script Author: BRShaw
'Script Purpose: Fix the FTAs for App-V clients that have been upgraded via a Service Pack
'Script Creation Date: 12/08/2009
'Script Modified Date: 12/08/2009
'Script Version: 1.0
'Revision History

'Ver Date      Person                  Description
'-------------------------------------------------------------------------------------
'1.0    12/08/2009   Brian Shaw                 Created Script.

If UCase(Right(WScript.FullName, 11)) = "WSCRIPT.EXE" Then
  wscript.echo "This script must be run under CScript." _
    & VbCrLf & "You can set this by running: CScript //H:CScript" _
    & VbCrLf & "at the command line."
  WScript.Quit
End If

''******************************************************************************
'* Global Variables
''******************************************************************************
Dim strOutFile, strDir
Dim strAppLauncherValue, strAppLKeyPath, strAppLValueName, strAppLValue
Dim strUIValue, strUIKeyPath, strUIValueName, strUserInterfaceValue
Dim objTextFile, objWMIService, objFile
Dim arrAppLValues
Debug_On = False
Const DeleteReadOnly = TRUE
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const ForReading = 1
Const OverwriteExisting = True
Const ForAppending = 8
StrComputer = "."
set oShell = createobject("wscript.shell")
strDir = oShell.currentdirectory
strOutFile = strDir & "\App-V_Fix_Output.txt"
strAppLauncherValue = "None"
strUserInterfaceValue = "None"

''******************************************************************************
'* Create a Text file for output of the script
''******************************************************************************
Set objFSOFileDelete = CreateObject("Scripting.FileSystemObject")
'If the output file exists befor then delete it.
If objFSOFileDelete.FileExists (strOutFile) Then
objFSOFileDelete.DeleteFile(strOutFile)
End If
'Create the Text file to write standard out to.
Set objFSOFileWrite = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSOFileWrite.OpenTextFile (strOutFile, ForAppending, TRUE)
objTextFile.WriteLine(Now)

''******************************************************************************
'* Determine What the App launcher setting is
''******************************************************************************
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strAppLKeyPath = "SOFTWARE\Classes\SCCM.VAppLauncher\shell\Open\command"
strAppLValueName = "command"
oReg.GetMultiStringValue HKEY_LOCAL_MACHINE,strAppLKeyPath, strAppLValueName,arrAppLValues

If instr(arrAppLValues(0), "VirtualApp") > 0 Then
  strTemp = Trim(arrAppLValues(0))
  strAppLauncherValue = strTemp
End If

If Debug_On Then
  objTextFile.WriteLine("This is the value of the first Array key: " & arrAppLValues(0))
  objTextFile.WriteLine("This is the value of the App Launcher key pulled from the registry: " & strTemp)
  objTextFile.WriteLine("This is the value of the App Launcher key we are using: " & strAppLauncherValue)
End If

If strAppLauncherValue = "None" Then
    objTextFile.WriteLine("The value did not exist in the regsitry!!")
End If

''******************************************************************************
'* Determine What the UserInterface Setting is
''******************************************************************************
strUIKeyPath = "SOFTWARE\Microsoft\SoftGrid\4.5\Client\UserInterface"
strUIDDEValueName = "DDELaunchMSICommand"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strUIKeyPath,strUIDDEValueName,strUIValue

If instr(strUIValue, "VirtualApp") > 0 Then
  strUserInterfaceValue = strUIValue
End If

If Debug_On Then
  objTextFile.WriteLine("This is the value of the User Interface key pulled from the registry: " & strUIValue)
  objTextFile.WriteLine("This is the value of the User Interface key we are using: " & strUserInterfaceValue)
End If

If strUserIValue = "None" Then
    objTextFile.WriteLine("The value did not exist in the regsitry!!")
End If

''******************************************************************************
'* Set the new value and write it back to the registry
''******************************************************************************

If instr(strUserInterfaceValue, strAppLauncherValue) > 0 Then
  objTextFile.WriteLine("The registry has alreday been updated with the correct App Launcher Command!")
  objTextFile.WriteLine("Here is the value of the App Launcher key: " & strAppLauncherValue)
  objTextFile.WriteLine("Here is the value of the User Interface key: " & strUserInterfaceValue)
Else
  Dim intStringLength, intStartPlace, intNumCharFromRight
  Dim strRightSide, strNewValue
  'Get the length of the user interface key
  intStringLength = Len(strUserInterfaceValue)
  'Find the starting place to cut the string
  intStartPlace = InStr(strUserInterfaceValue, "launch")
  'Find how many characters to pull from the right side, had to subtract the 3 places back from the search string we used
  intNumCharFromRight = intStringLength - (intStartPlace - 3)
  strRightSide = Right(strUserInterfaceValue, intNumCharFromRight)
  If Debug_On Then
    objTextFile.WriteLine("This is the length of the string: " & intStringLength)
    objTextFile.WriteLine("This is the Starting location we are using: " & intStartPlace)
    objTextFile.WriteLine("This is the Number of Characters from the right side we are pulling: " & intNumCharFromRight)
    objTextFile.WriteLine("This is the string we pulled back:  " & strRightSide)
  End If
  'we are now going to add the strings together to get the completed new string
  strNewValue = strAppLauncherValue & strRightSide
  If Debug_On Then
    objTextFile.WriteLine("This is the strings added together: " & strNewValue)
  End If
  'Update the registry key with the new values
  oReg.SetStringValue HKEY_LOCAL_MACHINE,strUIKeyPath,strUIDDEValueName,strNewValue
  strUIValueName = "LaunchMSICommand"
  oReg.SetStringValue HKEY_LOCAL_MACHINE,strUIKeyPath,strUIValueName,strNewValue
  objTextFile.WriteLine("The User Interface option has been updated with this value: " & strNewValue)
End If

 

''******************************************************************************
'* Close the Text File
''******************************************************************************
objTextFile.WriteLine
objTextFile.WriteLine(Now)
objTextFile.Close

 

==========================

I have tested the script and it does work, just don't forget to restart the client machine.  Just copy all text between the "===" lines and then put in a file called App-V_Client_Fix.vbs and execute it with cscript like this:

cscript App-V_Client_Fix.vbs

The output of the file will be contained in a file called App-V_Fix_Output.txt

Note:  This script is intended as an example only and will not fix all situations.  Its intended use is to fix the Launch MSI commands that do not get updated during an upgrade of SCCM.  It will not fix your FTA issues that might arise by disabling the SCCM App-V integration.

Hope this helps,

Brian Shaw | Senior Support Escalation Engineer