Solved

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

Posted on 2016-10-16
4
47 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 70

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 18

Assisted Solution

by:Mal Osborne
Mal Osborne 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 34

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 34

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

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

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

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
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…

726 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