WIX non admin Installation - c#

I have an issue regarding wix setup generation, here is my scenario
I have created a setup and tried to install on completion of installation I have done code to create a key in HKCU(H key current user), upto here it is fine.
Now if I try to install with non admin rights then it asked for admin password, then I have entered, installation is completed, problem is the key which I tried to insert in HKCU (Current User) is inserted into the admin account not in the current account where I am installing.
FYI
I am using C# winforms and WIX to generate setup
Any help would be greatly appreciated..
Kind Regards,,
Raghu.M.

You can create an installer that can be executed by non-administrator: https://stackoverflow.com/a/14358274/129269
As mentioned you can no longer install things that require elevated privileges. But on the other hand, when trying to add values to the HKCU my guess is you don't want to install system wide resources.

Update your application to write the default HKCU registry data on first launch. It is much easier than having your setup do the job.
For a description on how you can manage HKCU values after they have been written - in case they need modification, deletion or changing during a reinstall of the application - you can check this thread: http://forum.installsite.net/index.php?showtopic=21552

Thanks for your reply,
This is the way, I approached to solve this.
I have created a component where it inserts key in Local Machine Which will be common for all, and thereby proceed further.
Kind Regards,
Raghu.M

Related

How to remove registry keys on uninstall msi using WIX

I need to remove registry keys when user uninstall application.
These registry keys are in HKEY_CURRENT_USER\SOFTWARE.
I am using WIX tool.
Please note that keys are not getting registered on install but after login based on action performed by user.
Thanks in advance
Windows Installer can only access the registry hive of the user it's running as. It's technically possible to write a custom action to enumerate the user profile list and load each ntuser.dat but this ultimately causes all sorts of problem. The short answer is it isn't practical. Besides, Microsoft standards state to leave user data behind on uninstall.
If you really want to do it, the best way I know is to use a custom action to write to the registry during uninstall (something MSI doesn't support). Have this registry value set up an ActiveSetup command to invoke reg.exe delete. Then when each user logs in next time the key will be deleted.

download click once application from browser

i was working on win application made its setup, and put it on site. when some user comes to site for first time it pormpts user to download my application. and while running setup i created a key in registry, that was checked in my script by site, that if key exists than user will not be prompted as he/she has installed app. when user uninstalls application, setup will delete regisrty key, wirtten on installation time.
Note: i added my site to trusted site and chaged its security to read my script.
Now scenario changes, user has asked to implement app in clickonce, so that they had to update app instead of uninstall and reinstall it. they still want clickonce app setup on site as mentioned above, but problem here is that when i run app first time it will write registry for that application but on uninstall it will not delete registry. as it is mentioned in following link set registry key through click once.
is there any way to accomplish this requiremnent. any help will b appreciated
check the update option is enable in the Publish settings ( if needed specify the minimum version for updating specify it also) .
when the application starts it will automatically checks for update. user dont need to uninstall every time
If you want to remove a registry key before the application uninstalls you will need to launch the uninstall process from a location within your code that you can control. To do this, you will need to have the user launch the uninstall process from within your application. When the user starts the uninstallation process, you will need to remove the registry key from within your application before continuing the uninstallation.
There is an excellent blog post (found here) by Jim Harte regarding automating the uninstall/reinstall process. His article is in regards to an issue with certificate renewal, but the uninstall process is the same.
If your user uninstalls the application through the Add/Remove Programs dialog, the key will not be removed. There is unfortunately no way that I am aware of to halt the uninstall process of a ClickOnce application so that you can remove a registry key. It's just an annoyance that you will have to live with, unless someone else around here has found a "creative" solution.

How to create a setup experience much like LogMeIn?

I would like to find out if someone (and maybe someone on StackOverflow works for LogMeIn, and can fill me in on the details) knows how to create a similar experience much like what you get with LogMeIn when you install their remote components on a computer, when logged into their site?
Typically, when you download and keep their remote components on a thumbdrive, you have to log into their software with your username and password, but when you're on their site, and click on "Add Computer" from their menu of options, the setup process bypasses the login process.
I'm writing up the specifications on a different tool, but similar in deployment model, and having that feature would make the setup process for the end user all the more simplistic in the long run.
Any assistance would be greatly appreciated.
Edit:
I did some digging and ran across this example of how to read from a table. So now I'm thinking maybe my way of doing this is to create a custom "download" page that when it gets clicked on, the msi is read into memory, I edit a custom property to insert a guid or other property that expires in 10 minutes or so, and use the guid to link the user account to the installation instance... Hmm... may work :)
Something to try during my next geek week before I go about building the msi installer for said project.
Windows Installer has the concept of transforms. LogMeIn is probably just using a base msi and programtically generating a transform and applying it as part of a watermarking process.
Morphing Installers ( with transforms ):
http://www.tramontana.co.hu/wix/lesson9.php
The concepts here are straightforward and the majority of your work is going to be integrating it into your websites build/release process.
Personally I get nervous about baking that much information into an MSI but the LogMeIn people obviously had a business case for making it as easy easy easy as possible for their users.
Once you have the admin password to a (non-firewalled) windows box, you can copy files, remotely update the registry, start services, etc.
This is one example of a remote VNC install procedure.
One remote desktop vendor (don't remember which) that I looked at allowed remote installation by ordering a computer to log in and install on any computer located on the same subnet.

SSIS Package won't execute when called

I have an 2005 SSIS package that I'm calling in a service created in VS 2005. The package will not run. The purpose of the package is to parse a file and put data into a "Load Table".
The package runs perfectly on its own, but will not run at all when executed programatically - when I'm stepping through the code. The Event Viewer indicates that the package has started but then it indicates that it has failed. I don't get any more information than that.
It's not throwing an exception. It's just returning "Failure". I've tried executing against different databases - Same result. The file it's parsing is valid becuase it runs fine when run on it's own.
The only other thing that I can think of is that I'm having some problem with user permissions, but I have no idea on how to go about looking into that issue. Does anyone have any ideas?
Sounds like a permissions issue. Make sure the process it is running as has the same permissions as the account which you are using to run it interactively.
Without more information it's hard to tell, but this sounds like a permissions issue.
When it's running from code, does the person or user account the code is running under have the appropriate permissions?
For example, if you run it manually, you're most likely using your own credentials. As the developer, I'd assume you have admin rights, so you can perform the task.
However, when run from a program you need to know what user account the program runs under. Is it Asp.Net? The default user is Network Service. Is it a Scheduled Task running under the default Local System account? You'd need to change the account it runs under or grant permissions on the DB appropriately.
When you loaded it from Studio to Integration Services, what Package Protection Level did you use? I've had the best luck with the last in the list: Rely on Server Storage and roles for access control.
Does your package have error logging set up? It could help you to see what the problem is.
Also, does the account for the service running the package have the correct rights to the directory where the file to be picked up is stored not just correct rights in SQL Server? We've had that problem before.
Have you attached Events to the execution of the package? Are you calling the package by code? Which Method are you using?
Please check Loading and Running a Remote Package...
Then when debugging, add a break point at the Console.Write Line where gets info of the error.
Hope it helps,
Arturo

SecurityException when using Registry.LocalMachine.OpenSubKey

I'm developing an application that needs to write to the registry. It works fine on XP, but when I run it on Vista, from Visual Studio, I get a security exception in:
Registry.LocalMachine.OpenSubKey("SOFTWARE", true);
I'm trying to write a new key into that branch of the registry.
What's the right way to do this, firstly so that I can run my application from VS on Vista, and secondly so that my users don't run into problems running on Vista.
Thanks...
On both XP and Vista you need Admin rights to write a new key under LocalMachine.
You'll be finding this works on XP and fails on Vista due to different account defaults.
The quick and dirty solution is to ensure your application runs with Admin rights in both cases, though in on Vista this tends to be frowned upon.
The better solution would be to redesign things slightly - can the new sub key be written by your installer (which runs with Admin rights), or could you store your information somewhere else?
Standard users, and admin's running with UAC on Vista, do not have permission to write the the local machine registry key. This would fail on XP too if you ran as standard user.
Your options are:
Use Registry.CurrentUser instead, if the setting is per-user.
Run your app as administrator
Loosen the ACL on the key so anyone
can write - which is definitely
not recommended, since any malware
on the box can toast the key.
You can only write to that key if you're running as administrator. So you'll need to run VS as administrator and your users will need to run the application as administrator.
My suggestion would be to see if you really need to write to LocalMachine. You can write to CurrentUser without admin rights.
I assume it "works under XP" because everybody runs it as Admin under XP?
You will could try to circumvent (create the key during Setup or use a key under CurrrentUser or something).
You could grant the privilege to your Application during Setup. I'm afraid I'm a little short on details on how to do that.
Use Registry.CurrentUser

Categories

Resources