Author Archives: Philipp Gerschwiler

Handling App-V File Type Association in Windows 10 and Windows 8

Since Windows 8 there are a lot of standard file type association set per User. For Example the file type of .mp3 is assigned to the Music Player App:

mp3Win8

If you sequence an application which set the file type association for mp3 as standard to the new application, then the App-V client will not override this  standard value mentioned above:

ftawin8

To avoid this, you have to create two single scripts, which have to be implemented in the DeploymentConfiguration.xml but this will only work for Domain Users and not for a local Windows User Account in App-V 5.0 sp2. This Issue has been fixed with App-V 5.0  SP2 HF4. You have to create a script not a single registry file, which should remove the association for the current user because regedit.exe is an elevated process. An elevated process can not be started by a user in an App-V configuration.xml

  1. Create a script which removes classes “OpenWithProgids” registry key called machine.vbs:
    Dim oShell: Set oShell = CreateObject(“Wscript.Shell”)
    Dim aExt, Ext
    aExt = Split(“|.mp3|”, “|”) ‘for more Values use this: (“|.mp3|.mp4|.wma|”, “|”)
    For Each Ext In aExt
    If Ext <> “” Then
    Call oShell.RegDelete(“HKEY_LOCAL_MACHINE\SOFTWARE\Classes\” & Ext & “\OpenWithProgids\”)
    End If
    Next
  2. Create a script, which will remove the the Current User association and adds the required association for your file type (this will only work for VLC):
    Dim oShell: Set oShell = CreateObject(“Wscript.Shell”)
    Dim aExt, Ext
    aExt = Split(“|.mp3|”, “|”) ‘for more Values use this: (“|.mp3|.mp4|.wma|”, “|”)
    For Each Ext In aExt
    If Ext <> “” Then
    Call oShell.RegDelete(“HKEY_CURRENT_USER\SOFTWARE\Classes\” & Ext & “\OpenWithProgids\”)
    Call oShell.RegDelete(“HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\” & Ext & “\OpenWithProgids\”)
    Call oShell.RegWrite(“HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\” & Ext & “\OpenWithProgids\VLC.” & Ext & “”, 0, “REG_BINARY”)
    Call oShell.RegDelete(“HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\” & Ext & “\UserChoice\”)
    End If
    Next
  3.  Import both files into App-V Package
  4. Edit DeploymenConfig.xml:
    <UserScripts>
    <StartVirtualEnvironment RunInVirtualEnvironment=”false”>
    <Path>wscript //B “[{AppVPackageRoot}]\..\Scripts\user.vbs”</Path>
    <Wait RollbackOnError=”true”/>
    </StartVirtualEnvironment>
    </UserScripts>
    <MachineScripts>
    <AddPackage>
    <Path>wscript //B “[{AppVPackageRoot}]\..\Scripts\machine.vbs”</Path>
    <Wait RollbackOnError=”true” Timeout=”30″/>
    </AddPackage>
    </MachineScripts>

Take care, that application has to be started once by each user, after that the file types are associated to your application.

For more information about package scripts, follow this guide: SHIMSs and App-V 5.0

For more information about file type associations in Windows 8, follow this guide: Windows 8: Associate a file Type or protocol with a specific app using GPO

ReSign VSTO Plugin

To silent install a vsto Office Plug-In it is required that the whole plug-in is signed with a valid certificate. If the certificate is out of date, you will  get this message during installation:

Unknown PublisherEven If you extract the certificate and install it to  the TrustedPublisher Store on the Current Computer you will get no response and the plug-in will not be installed. If you have a look to the event viewer you’ll see this error message:

Event Error

It is necessary to install the VSTO-Plugin silently without any warning, if you want to deploy the Plugin. This is not possible, if the certificate is out of date. The Microsoft Visual Studio contains the mage-tool, that can sign the VSTO and manifest file. You have to resign the DLL, manifest and VSTO files. Follow the following procedure step by step to resign the Plugin properly:

  1. Sign the DLL  with your custom certificate.
  2. Use mageui.exe or mage.exe to sign the Manifest file. Just open the the Manifest and populate the files.
  3. Remove the VSTO file from the Application files table.
  4. Save the manifest file. You will get an error, that the original signer could not be found, you can safely ignore this massage and sign the manifest with your .pfx certificate.

After that, you have to sign the VSTO file with the mageui tool. Open the VSTO and  go to “Application Reference”.

vsto

Select your fresh signed manifest file, save the project and add your certificate information into the signing options.

The vsto plugin is signed now with a valid certificate and can be installed silently.

Active Setup and Per-User/Per-Machine registry

The Windows Installer allows you to create a setup which will dynamically writes registry keys into either  HKCU or HKLM. This behaviour is then controlled by the “ALLUSERS” Property.

The Windows Installer Help describes this feature as follow:

 Constant  Hexadecimal  Decimal  Root key
 (none)  – 0x001  -1  If this is a per-user installation, the registry value is written under HKEY_CURRENT_USER.If this is a per-machine installation, the registry value is written under HKEY_LOCAL_MACHINE. Note that a per-machine installation is specified by setting the ALLUSERS property to 1.

We will now provide an example to illustrate this behaviour:

reg01

 

In this MSI I have chosen the “AppDataFolder” system property as Value  in order to check the resolved path. The path will be different for each user because its an per-user defined system property.

If you install this key with the ALLUSERS Property set to “1” the result will be as following:

[HKEY_LOCAL_MACHINE\SOFTWARE\Ontrex\Example]
"UserOrMachine"="C:\Users\Administrator\AppData\Roaming\"

The key will be installed into HKLM however the property will be resolved according to the current installing user.

If you install this application again with ALLUSER set to “2”  the result will look like this:

[HKEY_CURRENT_USER\Software\Ontrex\Example]
"UserOrMachine"="C:\Users\test\AppData\Roaming\"

More details about this behaviour/feature can be obtained from the following MSDN Article:

http://blogs.msdn.com/b/windows_installer_team/archive/2009/09/02/authoring-a-single-package-for-per-user-or-per-machine-installation-context-in-windows-7.aspx

Conclusion: The registry root parameter can be used to dynamically write the registry keys into HKCU or HKLM  based on the current installation context (Per-User <> Per-Machine)

But what happens if you have a per machine installation which contains an active setup mechanism?

Let’s have a deeper look into it:

We add all corresponding registry keys, features and components to the MSI  which are required  for a fully functional Active Setup.

Now let’s install the MSI under system account with ALLUSER=1 and check the example registry key.

The Result is:

[HKEY_LOCAL_MACHINE\SOFTWARE\Ontrex\Example]
"UserOrMachine"="C:\Windows\system32\config\systemprofile\AppData\Roaming\"

Now log off and log on with a standard user account and check the key again and something unexpected happened. As you see the key changed to:

[HKEY_LOCAL_MACHINE\SOFTWARE\Ontrex\Example]
"UserOrMachine"="C:\Users\test\AppData\Roaming\"

What happend?

The Property ALLUSERS sets the installation to a  machine installation and the Active Setup will be execute with the following option “/fu” (all required user-specific registry entries).

Answer:
During the active setup the windows installer will repair the MSI in User Context and only user-specific registry keys will be rewritten (“/fu” parameter). All “-1” however are simply considered as “user based keys” even the ALLUSERS property is set to “1”. Because the repair works with elevated priviliges this HKLM key will now be rewritten using the current users [AppDataFolder] value.

Our conclusion

We will kindly advice you not to use “-1” in the root column of the Registry table in a windows installer database in conjunction with active setup. Also bear that in mind when you are adding activesetup to an existing vendor msi (Transform).

Regards,

SPA Team

ICE27 Error Unknown Action: MsiConfigureServices on AdminStudio 2012 SP2

The newest .CUB File from Admin Studio 2012 SP2 contains an error. As you can see if you validate a MSI Package:

28.03

 This error message is not really an error from the validated MSI and can be ignored but it’s not very beautiful to get this error on every validation.

There is only one new line needed inside the CUB File (which contains the validation rules) and it can be fixed very fast:

You need the actual darice.cub file to modify the validation rules, this file can be found here:

“C:Program Files (x86)InstallShield2012SpringSupportValidationdarice.cub”

Open this file with a standard Windows Installer Editor (Insted or Orca) and go to the table _Action. Add a new row into this table with the following options:

MsiConfigureServices

Action: MsiConfigureServices
SectionFlag: 8
Prohibited: 31
Required: 0

Save and close the darice.cub file.

28.03_002

 

You should no longer receive  this validation error.

 

Windows 8 SDK (contains newest Windows Installer SDK 5.0)

The newest darice.cub, where this changes are already applied, is also available on the following page:

http://msdn.microsoft.com/en-US/windows/desktop/hh852363.aspx

Download the SDK and install the newest Version of Orca. You will find the darie.cub inside the main installation folder. Replace this one with the old validation file inside the InstallShield Directory.

Regards,

SPA Team