Solved

Write registry keys to current user rather than admin user that installs the application

Posted on 2016-10-16
4
39 Views
Last Modified: 2016-11-05
I have a c# application that writes registry keys to the current user profile on installation. The company wants to roll out the application use an admin user and so when they run the MSI as that admin user, the registry keys get stored under that profile, rather than the profile that is currently logged in.

How can I fix this?
0
Comment
Question by:thinklings
  • 2
4 Comments
 
LVL 68

Accepted Solution

by:
Qlemo earned 200 total points (awarded by participants)
ID: 41845909
You can't - that easily. Your choices are always to install for everyone (using HKLM and the All Users file locations) or for the current user.
But if you run an installer as admin while logged in as the user, you should have access to the user profile. I have to admit I don't know if HKCU points to non-admin or admin user, and if the latter how to know which is the correct profile ...
0
 
LVL 17

Assisted Solution

by:Malmensa
Malmensa earned 150 total points (awarded by participants)
ID: 41846195
If the target machine is a terminal server, make sure you throw it into install mode before you do the install. This is done at the command prompt with "Change user /install". Once the app has been installed, use "Change user /execute".

More here:

https://support.microsoft.com/en-us/kb/186504
0
 
LVL 33

Assisted Solution

by:sarabande
sarabande earned 150 total points (awarded by participants)
ID: 41846806
if the target user already has admin rights, you easily could run the Setup program (after uninstalling) from user account 'as administrator'. then the current user automatically should get the right settings in the registry.

if they are not Administrator, I mean the 'run as administrator' will ask for both, adminstrator account and password, what also should have the wished result.

if i am wrong, it may simplest for you, to temporary make them an Administrator.

if that isn't an option the user may login at their account. then you would open a command window and start the setup with runas command:

runas /profile /env /user:mydomain\admin "setup program or msc"

the /env would make that the local environment was used for the setup.

Sara
0
 
LVL 33

Expert Comment

by:sarabande
ID: 41875267
Unfortunately the Asker didn't respond, but the given solutions are valid nevertheless and should be PAQ'ed.

Sara
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now