Run As

Got a problem you cannot solve? Try here.
matthewj
Posts: 66
Joined: Tue Dec 07, 2004 12:48 pm

Run As

Postby matthewj » Tue Dec 07, 2004 1:16 pm

Here's an issue that I've had a problem with, and I wonder whether InstallAware can resolve it, or whether I have to do my workaround.

My app needs at least Power User rights (I note that IW3 only allows an Admin rights check). Of course many people don't have Admin rights, so the Administrator walks up to the machine, uses Run-As to install it, and then walks away. What happens is that my installer has a "Run Now" option at the end (as does IW3), and that gets run. The user creates something in My Documents, and then closes the app. When they run the app later, they find their document disappeared. The reason of course is that the original was in the My Documents for the admin user, and now they are looking in their own real My Documents.

The only way I've been able to solve this is simply to stop the user being able to run the app at the end. This is something I've been annoyed by in installers, but maybe they found this issue too.

Now, I've looked for a Microsoft API to find out if the current app is running using another account, but not found anything I can use and trust. Does the MSI technology overcome this issue? Is there anything in InstallAware that will help? Or is it just a case of a problem that will never be solved?

I'd appreciate any thoughts on this matter.

Matthew

sinan
Site Admin
Posts: 1020
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Tue Dec 07, 2004 5:13 pm

Windows Installer might be able to help. As you may know, Windows Installer is a service that runs in its own security context. This helps it perform installs with elevated priviledges - installs can work without power user rights (provided they are authored properly and do not attempt to write to protected folders/registry keys without admin rights).

So you can therefore skip the "Run As..." step and have the users themselves install the software directly. Therefore, when they run the app at the end of the install, it will be running under their own account.

I'd definitely encourage you to try out and see for yourself - just create an install in IA and see if it works out as planned.

matthewj
Posts: 66
Joined: Tue Dec 07, 2004 12:48 pm

Postby matthewj » Wed Dec 08, 2004 6:03 am

Okay, I'll try it out and let you know how it goes.

Matthew

matthewj
Posts: 66
Joined: Tue Dec 07, 2004 12:48 pm

Postby matthewj » Wed Dec 15, 2004 2:53 pm

Okay, I've now bought InstallAware, and have tried out various scenarios. I created a new installation of Win2k in VMWare, and got it all updated using Windows Update to get to a known state.

I then created a new user with no elevated privileges. Running the test installer I made (which installs an app to Program Files) goes through the wizard okay, but fails with insufficient rights during the actual install. Using Run As and selecting an administrator installs it, but the app then runs in the Admin context showing the admin My Documents (the root cause of this thread). Uninstall wasn't possible by the basic user (rights again), but admin worked okay.

I then logged out, gave the user power user rights, and tried again. This time the installer worked fine, so long as I chose "this user" and not "all users" for the icon option (choosing the latter fails with admin rights again). When the app ran at the end, it was in the proper user's My Documents.

I then built the installer with admin rights required. The user with power user rights is now no longer able to install.

So, what to conclude?

First, I think it needs to be able to detect power user rights, since that is going to be quite common (it is the default for new users on Win2k), and the app did install with those rights. I presume I can modify the dialogs to disable the "all users" if there are no admin rights.

Second, I think that running at the end of the install isn't a sensible option. You just can't tell if it is going to be administrator or not, and thus how to behave. I guess I could detect it in my app, and warn the first time, but it isn't clean. I was hoping MSI would help solve this problem, but it seems every installer is stuck with this dilemma, and only one good solution. Maybe someone will show me a solution one day! 8-)

I look forward to Power user detection. :wink:

Matthew

sinan
Site Admin
Posts: 1020
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Wed Dec 15, 2004 3:18 pm

I think the default dialogs already disable "All Users" if the user is not running with admin rights...so that should already be set up for you automatically.
Also, you can just delete the "Run Program" checkbox from the "finish" dialog, and then also remove the line in your script which launches your application. Its easy to customize things in InstallAWARE :)

I understand what you are saying about the issue however...and am open to suggestions about what we can do to take care of it. Power User detection is a good idea. But its not exhaustive - users can also install Windows Installer (and also, InstallAWARE) apps with User rights (what is now termed "limited user") as long as they choose their home folder for the target of the installation.

So its a complex issue! But I am definitely eager to hear ideas on how to approach it, and incorporating those suggestions in newer versions.

matthewj
Posts: 66
Joined: Tue Dec 07, 2004 12:48 pm

Postby matthewj » Wed Dec 15, 2004 3:35 pm

sinan wrote:Also, you can just delete the "Run Program" checkbox from the "finish" dialog, and then also remove the line in your script which launches your application. Its easy to customize things in InstallAWARE :)


Interesting you should say that. I've edited the dialog, which is the Windows Installer theme, and changed it so that if we have SUCCESS, the run app checkbox is made not visible (so it should now never be visible). But the RUNAPP seems to always be TRUE, since my code runs the app. Obviously I will remove my code to run the app, but I thought I'd work out how to stop it doing it properly, but I can't. What is the default for a variable? The first reference found by searching is the "IF RUNAPP IS TRUE". Most odd this.

I'll also check the "all users" in another theme, since that is also not working in the Windows installer one. Oh, and I guess the nice bitmaps aren't available for re-doing the graphics with our product name on?

Thanks,

Matthew

matthewj
Posts: 66
Joined: Tue Dec 07, 2004 12:48 pm

Postby matthewj » Wed Dec 15, 2004 3:37 pm

To elaborate, the dialog for the "run" has the run UNCHECKED at design time, but CHECKED at run time (I just allowed it to show again). Why might this be?

Thanks,

Matthew

matthewj
Posts: 66
Joined: Tue Dec 07, 2004 12:48 pm

Postby matthewj » Wed Dec 15, 2004 3:46 pm

Well, setting it explicity to FALSE before the finish dialog makes it work as expected. I'm intrigued that a variable defaults to TRUE.

Matthew

matthewj
Posts: 66
Joined: Tue Dec 07, 2004 12:48 pm

Postby matthewj » Wed Dec 15, 2004 3:54 pm

sinan wrote:I think the default dialogs already disable "All Users" if the user is not running with admin rights...so that should already be set up for you automatically.

FWIW, the modification seems to be based on whether this is NT or not, not whether there are admin rights.

Matthew

sinan
Site Admin
Posts: 1020
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Wed Dec 15, 2004 6:45 pm

Thanks for your observations. We indeed are setting the "All Users" visibility condition based on whether the OS is NT or not, and not whether they are admin. You can quickly modify that behavior:

1) Replace the text $ISNT$ on the dialog with text $ISNTADMIN$
2) In your script, define a variable called ISNTADMIN, and set it to FALSE by default. Set it to true only if the OS is NT and the user is ADMIN.

About the Windows Installer theme bitmaps...if you would like to customize them, I'd be happy to deliver the raw PSD files to you as a courtesy :D I am sure you can edit them and create wizard bitmaps to your satisfaction.

matthewj
Posts: 66
Joined: Tue Dec 07, 2004 12:48 pm

Postby matthewj » Thu Dec 16, 2004 5:06 am

Thanks, I'll modify the installer for admin/all users as you suggest.

sinan wrote:About the Windows Installer theme bitmaps...if you would like to customize them, I'd be happy to deliver the raw PSD files to you as a courtesy :D I am sure you can edit them and create wizard bitmaps to your satisfaction.


I'd much appreciate that. The best address is the one for this forum, which includes the word tech-nical (without the dash) and the top-level com domain ban-xia (again, no dash). (Sorry, don't want this one to get any spam!).

Thanks, Matthew


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 41 guests