App-V client install may fail with error 1603 due to performance counter registration errors

I was going through some of the issues we saw during the 4.5 beta and came across another one I thought you might find interesting.  This is one where the installation of the App-V client will fail with the following error:

"Installation operation failed. Error 1708"

If you then check the Verbose MSI log you'll also see something along the lines of the following:

=============================
Verbose MSI logs will show MSI (s) (34:68) [19:45:35:263]: Note: 1: 1708
MSI (s) (34:68) [19:45:35:263]: Product: Microsoft Application Virtualization Desktop Client -- Installation operation failed.

MSI (s) (34:68) [19:45:35:263]: Cleaning up uninstalled install packages, if any exist
MSI (s) (34:68) [19:45:35:263]: MainEngineThread is returning 1603
MSI (s) (34:64) [19:45:35:279]: Destroying RemoteAPI object.
MSI (s) (34:88) [19:45:35:279]: Custom Action Manager thread ending.
=== Logging stopped: 7/24/2008 19:45:35 ===
MSI (c) (48:C8) [19:45:35:279]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (c) (48:C8) [19:45:35:279]: MainEngineThread is returning 1603
=== Verbose logging stopped: 7/24/2008 19:45:35 ===

The key here is where it says MainEngineThread is returning 1603.

The exact cause of this can vary but is most likely due to a performance counter registration related issue.  This can happen when a previous version of the client was installed at one time and the unregister failed when it was uninstalled, or there could be registry / file permissions on the machine that are not allowing the creation of one of the temporary files needed to create and register the performance counters. 

To fix this we'll need to clean up the client in question in order to allow a proper re-installation.  To do this open a CMD prompt on the client in question and run the following commands:

regsvr32 /u mavcperf.dll

and then

mofcomp <PATH>\SGCliprvUninstall.Mof

Note: If you are unable to unregister mavcperf.dll (step #1 above) you can perform the following steps:

1.) Run the following command from a command prompt:

unlodctr "Mav Client PerfMon Provider"

2.) Delete the following registry key: 

HKLM\System\CurrentControlSet\Services\MAV Client PerfMon Provider

With any luck, once you do this the client will now install without error.

I'd also like to extend a special thanks to Steve Thomas.  He diligently worked so many of these beta issues and discovered many of the solutions I post here, including this one.  Without him many of these issues would go undocumented.

Hope this helps,

 J.C. Hornbeck | Manageability Knowledge Engineer