Creating Custom Action/Registry changes on the fly (inMST)

Hi guys, I wanted to pick y’alls brain for a minute.
I saw @That-Annoying-Guy post on creating custom ARP entries and I approached this to the management to only have it shot down (smh) Create Custom Programs and Features Entries.

Currently, in the env I am creating MST on the fly using our lovely built in transform properties since I am only changing things like ARPCOMPONENT, ARPCONTACT, etc.
What we’re trying to accomplish now is to create a String Value under the GUID where the software is Installing. Now I have been able to achieve this by inputting in Post-Installation however, when our IT Help Desk goes to uninstall software; they are using ARP Uninstall which will be set to the msiexec.exe /IGUID and when that happens, the reg string I created under the GUID (during Post-Installation) will remain there.

I tried creating the regkey via TransformProperties but that just creates Property entry and not really a entry in regedit. My other research has led me to open MSI in Orca and creating SQL command to create Custom Action which will run vBscript or so but I don’t have much knowledge in SQL.

I guess we can keep this as an open forum for everyone to chime in their thoughts on how to create Custom Action (on the fly) OR Create Registry String/DWORD under the GUID where software is Installing and it will Install along with MSI so when a user Uninstalls the software; it does remove the entire Registry entry of that GUID.

Hey, an MSI removes only that, what it delivers, not more or less.

You can use ORCA to add an registrykey.
Example:
Registry: is Just a Name
Root: 2 is HKEY_LOCAL_MACHINE
Key: is SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall[ProductCode]
Name: is YOURNAME
Value: ist #WHATYOUWANT (# before is a DWORD, without is STRING)
Component_: is … a compenent that already exist where other registry entrys creates in HKLM

Thats it

Correct manually I can do - that’s not an issue.
However, I wanted to know if someone had any ideas or thoughts to do this on the fly.
I saw some SQL commands that people wrote to add CA (Custom Action) and use vBscript but their vBscript was just doing “hi, I am vBscript” vs what I will need is going to be longer script.

As long as you are only plugging the registry in the ARP section of the registry, MSI should let you do it.
As for Custom Actions, stay away from VBS scripts that are embedded in a Custom Action or are run directly by MSI itself. Launch it by Csript.exe or Wscript.exe.

You could in theory use the functions in a standalone PS1 script that your MST triggers by launching powershell.exe. You would need to remove calls to other PSADT functions but it should work.

RANT SECTION*

Doing it this way, however, is cumbersome and slow to develop due to building a custom MST file for each MSI. And what about non-MSI packages? Wrap them inside an MSI just to hide the EXE’s ARP entry? Repackage into MSI at all cost? I lived through this 15 years ago on a global network. The solution stopped 90%+ of HelpDesk uninstall errors by dealing with them outside of MSI. And we did this with CMD until MS forced us into PowerShell…