detect if MSI is running as admin or user - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

skipau
Posts: 31
Joined: Mon Feb 22, 2010 5:12 am

detect if MSI is running as admin or user

Hi there,

I have set my MSI to have an Installation Type of "Per machine if the user is administrator or Per user otherwise".

I have 2 things I want the MSI to do (over and above the usual install of files).

(1) Take a supplied property and put it in HKLM if the install is administrator or HKCU if the user is just a user
(2) If the install is runing as per user then put in an additional value (from another supplied property) into the HKCU.

I am able to do (1) easily by putting my property into the "Current user/Local machine" Registry location. That works fine.

The problem I have is with (2). I was hoping to basically use a custom action and just read a value from the MSI which would tell me if the MSI was running as administrator or user and then I could put in the registry value based on the results of that.

I have did some searching etc and thought InstallType might be the property - but that isn't it. I also tried MSIINSTALLPERUSER but that didn't seem like it either.

Would you you know what property I could read to see what AE has decided to run the MSI as?

thanks

Jeff
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: detect if MSI is running as admin or user

Hi Jeff,

For (2) simply create the registry key/value under HKEY_CURRENT_USER on the Registry page in Advanced Installer. Go to the registry key/value's component and condition the component using the ALLUSERS property. Let me know how this worked for you.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
skipau
Posts: 31
Joined: Mon Feb 22, 2010 5:12 am

Re: detect if MSI is running as admin or user

thanks for that Gabriel...

I setup my registry value under HKEY_CURRENTUSER. Under the Organisation I found the component. I will then set the Condition to: ALLUSERS="" as I want it only to install when it is a User based install.

Worked like a treat - with lots of boring testing!!

Thanks again for your excellent help!

Cheers

Jeff

Return to “Common Problems”