• Welcome to Support Forum: Get Support for Patch My PC Products and Services.
 

Detection script for User installs

Started by altu, April 11, 2024, 06:43:15 AM

Previous topic - Next topic

altu

Hi,

We have used the PMPC portal to create custom apps successfully.
With two applications, which are kind of special I would say, we see an issue with the detection script.

The applications are simple MSI applications.
However, it has to be installed as user (/qn ALLUSERS=2 MSIINSTALLPERUSER=1).

But, after installation, these two particular applications create their entries in the HKLM hive:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\

The detection script fails to detect these application as it only looks in HKCU.

My workaround currently is to change script manually. Outside of PatchMyPC.

Line 16: [string[]]$HivesToSearch = 'HKCU'
Change to: [string[]]$HivesToSearch = 'HKLM'

This fixes the detection.

Three questions here:
1. If we make a request for you guys to add these applications to your catalog (they are publicly available), will you take this into account?
The application can be installed as user and as system, but our requirement is to install it as user.

2. Is there a better way to tackle this rather than having to make changes to the detection script?

3. Would it not be feasible that you add some additional options in the PMC portal that give us some more options. One of which is in what registry hive to search in? (I know, it's a feature request).

-----------

To elaborate on the first question...
If the application is installed as SYSTEM, on first run, the application runs a repair cycle to create the HKCU application configuration keys.
But, with Intune, after installation, the IMECache folder is cleared and the original install file is gone.
The repair then fails and prompts for the original install file.


Thank you

Dan Gough (Patch My PC)

Per-user MSIs are problematic for us at this point in time. Our custom apps functionality will look for the Uninstall key under HKCU for a per-user app (which is where setup.exes will write to), however per-user MSIs still register themselves under the HKLM Uninstall key (along with a per-user entry under HKCU\Software\Microsoft\Installer\Products).

However, our detection rules are Powershell scripts built by rules that will look for the display name under the HKLM Uninstall key for per-system apps and the HKCU Uninstall key for per-user apps.

This is something we are looking to improve upon, although unfortunately I can't give you a timeline right now.



My recommendation would be to try and resolve the issues that make it fail when running it as a per-system installation. There are a few ways to solve the issues you mentioned:

- Intune cache: If you copy the MSI to a location such as C:\ProgramData\PackageCache\{GUID} before installing it, it will be cached. Don't forget to remove the folder upon uninstall. PSAppDeployToolkit has native functions for this - Copy-ContentToCache and Remove-ContentFromCache.

- You can also avoid the whole MSI self-heal scenario by pre-supplying what it is looking for. It is usually a HKCU registry marker, but the repair could be being utilised to supply user files also. Again PSAppDeployToolkit has native functions (Copy-FileToUserProfiles and Invoke-HKCURegistrySettingsForAllUsers) to make this easy.

Using PSADT within Custom Apps is currently not a great experience however due to the fact a workaround is needed to add folder content:

https://docs.patchmypc.com/installation-guides/patch-my-pc-cloud/custom-apps/helpful-hints#workaround-for-applications-that-require-folders-to-be-uploaded

There is another simple solution however, and that is to use Master Packager to create an MST file that uses their predefined custom actions to provide the user files and registry:

https://www.masterpackager.com/support/predefined-custom-actions



What is the app in question? If it's not already listed, add an entry under https://ideas.patchmypc.com!

altu

Thank you for your extensive reply Dan.
To be honest, all my apps from the last 5 years have been packaged with PSADT, before we purchased PMPC.
I know how to easily fix these things with PSADT.
But I wanted to make use of the custom app portal now that is there.

I thought it was not possible to use PSADT as you could not upload folders to the custom app.
Didn't know about the workaround.
I also don't think this is an elegant solution to be fair. So for now, I will keep the app as is, deployed to user, and with a changed detection script.


The two applications are:
https://openstepviewer.com/
https://www.visual-planning.com/en/support-portal/vpdesk-new-launcher (this one does need to be deployed as user)

I will launch an idea for these two apps.