App-V Integration with ConfigMgr 2007 Using ‘User-Based Targeting’, ‘Update Package’, and ‘Download and Execute’

When updating App-V packages using ConfigMgr’s ‘Update Package’ command when your scenario includes ‘User-Based Targeting’ and ‘Download and Execute’, be aware that the following situation can occur if an App-V package is registered with the App-V client by two separate users. In this case, if the App-V package is updated on ConfigMgr with the ‘Update Package’ command, when the ConfigMgr client runs the updated App-V package for a targeted user, the following error is displayed on the client (may require running it a 2nd time to see the error on the screen).
‘The package could not be registered with the Application Virtualization Management client’
ConfigMgr 2012 resolves this issue. For ConfigMgr 2007, a workaround that can be considered with the use of ConfigMgr App-V ‘Update Package’ command in this scenario is to add a ConfigMgr program that deletes the App-V package from the App-V client as a dependency to the ConfigMgr App-V package.
The following command line can be setup as a ConfigMgr package and program to delete an App-V package from the App-V client. In this example, either App-V package name or App-V package GUID can be used. App-V package GUID is preferred since the App-V package GUID will remain the same while the App-V package name may change.
sftmime delete package:<App-V package GUID>
The following .vbs script can be manually run on the ConfigMgr server to add a ConfigMgr program dependency to a ConfigMgr App-V package, and set the dependency to run always. The script sets options that are not available in the ConfigMgr GUI for App-V packages (but are available by GUI for a standard ConfigMgr program). The section marked by < and > designate areas that require modification (ConfigMgr App-V package id, ConfigMgr dependent package id, ConfigMgr dependent program name).

strSMSServer = “.”
strPackageID = “<packageid>”
strProgramName = “[Virtual application]”
Set objLocator = CreateObject(“WbemScripting.SWbemLocator”)
Set objSCCM = objLocator.ConnectServer(strSMSServer, “root\sms”)
Set Providers = objSCCM.ExecQuery(“SELECT * From SMS_ProviderLocation WHERE ProviderForLocalSite = true”)
For Each Provider in Providers
 If Provider.ProviderForLocalSite = True Then
  Set objSCCM = objLocator.ConnectServer(Provider.Machine, “root\sms\site_” & Provider.SiteCode)
 End If

Set objProgram = objSCCM.Get(“SMS_Program.PackageID='” & strPackageID & “‘,ProgramName='” & strProgramName & “‘”)
WScript.Echo “Dependent Program for ” & strPackageID & “:” & strProgramName & ” currently set to ” & objProgram.DependentProgram
objProgram.DependentProgram = “<dependent package id>;;<dependent program name>”
WScript.Echo “Dependent Program for ” & strPackageID & “:” & strProgramName & ” currently set to ” & objProgram.DependentProgram

WScript.Echo “Flags for ” & strPackageID & “:” & strProgramName & ” currently set to ” & objProgram.ProgramFlags
WScript.Echo “If not already set by checking the appropriate bit, adds flag 0x00000080 (RUN_DEPENDENT_ALWAYS. Runs everytime instead of only on first run of advertisement)”
If (objProgram.ProgramFlags and 128) = 0 then
 WScript.Echo “Flag Not Present – Setting Flag”
 objProgram.ProgramFlags = objProgram.ProgramFlags + 128
 WScript.Echo “Flag Already Set”
End If



Note: ConfigMgr 2007 using App-V streaming may produce the same error in the same situation. However, the update works succesfully.

Note: No warranty or support is implied with the use of the scripts discussed in this article.

Comments (0)

Skip to main content