Support Forum: Get Support for Patch My PC Products and Services

Commercial Products: Support for Our Enterprise Product for Microsoft ConfigMgr and Intune => Commercial/Paid Products: Support and General Questions (ConfigMgr and Intune) => Topic started by: Matthias Veelaert on August 17, 2022, 02:13:25 AM

Title: Pre-install script for Registry Keys
Post by: Matthias Veelaert on August 17, 2022, 02:13:25 AM
Hi,
I have written a powershell script for the ShareX app so I can choose where the app installs to. To do this I had to create a new folder in the registry and an extra key/value in this folder. Locally when I run this script it works perfectly, it creates the folder and key/value pair and then when I download the ShareX app via the company portal, it downloads to this place. Now I added the script as a pre-install script in PatchMyPC so that whoever decides to download the app, gets it installed to this path. However that is not the case. It installs to the default path again and no registry key/value pair is created on my machine.

The script I wrote is this:
New-Item -Path "HKLM:\Software\ShareX"
Set-ItemProperty -Path "HKLM:\Software\ShareX" -Name "PersonalPath" -Type "string" -Value "C:\ShareX"

Any ideas why this won't work?

Kind regards!
Title: Re: Pre-install script for Registry Keys
Post by: Matthias Veelaert on August 23, 2022, 12:03:42 AM
Anyone? :D
Title: Re: Pre-install script for Registry Keys
Post by: Liviu (Patch My PC) on August 23, 2022, 12:35:03 AM
Hi Matthias,

Was the pre-install script added to ShareX after the app or updated was initially created?
If that is the case, if the app/update was already created, it was created without the script in the content for it.
You would have to delete and the re-create the app/update.
Title: Re: Pre-install script for Registry Keys
Post by: Matthias Veelaert on August 23, 2022, 12:42:53 AM
It was indeed added after the app was created. How would I do that. Just unassign the app and also uncheck the app, republisjh delete it in intune and then republish it again to intune?
Title: Re: Pre-install script for Registry Keys
Post by: Andrew Jimenez (Patch My PC) on August 30, 2022, 05:19:45 PM
Hi Matthias,

You should be able to right click the app in the Patch My PC interface, and choose to "Republish" the app during the next sync schedule, then run a sync.