Solved

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

Posted on 2016-10-16
4
33 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)
Comment Utility
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 16

Assisted Solution

by:Malmensa
Malmensa earned 150 total points (awarded by participants)
Comment Utility
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 32

Assisted Solution

by:sarabande
sarabande earned 150 total points (awarded by participants)
Comment Utility
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 32

Expert Comment

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

Sara
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Introduction You may have a need to setup a group of users to allow local administrative access on workstations.  In a domain environment this can easily be achieved with Restricted Groups and Group Policies. This article will demonstrate how to…
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 to another domain controller. Log onto the new domain controller with a user account t…

744 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

8 Experts available now in Live!

Get 1:1 Help Now