App-V 5 has evolved significantly since its initial release in the fall of 2012. Many of these changes have had an effect on how the Office 2013 AppV Package interacts with the Explorer shell and, as a result, have created a challenge for those of us (like me) who like to first test Connection Groups which contain the Office 2013 AppV package.
I find testing Connection Groups first in standalone mode very valuable because I can confirm that the connection group works and get fine tune the application package order as needed when I am testing and debugging Connection Groups. I can then test the deployment though the App-V Publishing Server or through Configuration Manager once I have validated that the Connection Group works.
TO quickly review how to create a connection group in stand-alone mode, you must first publish the packages. In the case of Office, I will publish the Office package globally as well as the add-ins I am testing. After the packages have been published, I can then proceed to create the connection group.
You create the Connection Group using the Add-AppVClientConnectionGroup cmdlet and you enable it (matching target) using the Enable-AppVClientConnectionGroup cmdlet. The Add-AppVClientConnectionGroup requires the creation of an XML descriptor document which is documented here: http://technet.microsoft.com/en-us/library/jj713474.aspx
Since the user state and launch management will be changing, the packages must not be in use. The thing is, you will find in App-V 5.0 SP2 and later, that once you try to enable the Connection Group, it fails with the following error – even though you have not launched any Office application:
The operation was successful but at least one of the Virtual Processes in this Connection Group is currently in use. Please shutdown all Virtual Processes in the Connection Group in order to complete this operation.
Operation attempted: Enable Connection Group.
AppV Warning Code: 0200000510
Sure enough, when you run the Get-AppVClientPackage command, you will see that the Office 2013 Package is indeed already in use. How is that possible you ask? Because of Dynamic Virtualization and the fact that Explorer is processed using virtual components by default. This is to enable support for enhanced shell extensions as well as applications that hook into Explorer directly such as OneDrivePro.
If you try to run the Stop-AppvClientPackage command against the Office 2013 package, you will find that it kills Explorer, which in turn automatically restarts, thus re-triggering the package back in use. You will also notice that the Connection Group enablement task does not show up under pending tasks in the HKLM\Software\Microsoft\AppV\Client\PendingTasks.
What you have to do is turn off Dynamic Virtualization and remove Explorer.exe temporarily from the ProcessesUsingVirtualComponents value in the registry: (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppV\Client\Virtualization)
I use these series of PowerShell commands:
First, I turn things off:
PS C:\WINDOWS\system32> Set-AppvClientConfiguration -ProcessesUsingVirtualComponents 0 -EnableDynamicVirtualization 0
I then reboot or restart the AppV Client service.
I then create and enable the Connection Group using the Add-AppVClientConnectionGroup and Enable-AppVClientConnectionGroup cmdlets:
Finally, I reset things back the way they were using the following PowerShell command:
PS C:\WINDOWS\system32> Set-AppvClientConfiguration -EnableDynamicVirtualization 1 -ProcessesUsingVirtualComponents %SystemRoot%\Explorer.exe,"%ProgramFiles%\Internet Explorer\iexplore.exe","%ProgramFiles(x86)%\Internet Explorer\iexplore.exe"
I then reboot or restart the AppV Client service and test the Connection Group functionality.
NOTE: Do not remove the ProcessesUsingVirtualComponents registry key manually as the absence of that key will cause the App-V Client service to fail upon startup.