cancel
Showing results for 
Search instead for 
Did you mean: 
Annie_B
Pilgrim

How to check for admin privileges in InstallScript

My app needs admin privileges to install because it has to install a font. In InstallShield 12, the following worked fine (this is a short version of a helpful message that tells them exactly what to do):

if (Is(USER_INADMINGROUP,"") = FALSE) then
MessageBox( "You need admin rights to install this app.", SEVERE );

With InstallShield 2010, that works fine the FIRST time a non-admin user tries to install. After that, however, the non-admin user automatically gets this uninformative message: "The installed version of the application could not be determined. The setup will now terminate."

Apparently, InstallShield checks for the version before my script can do anything at all. That would be fine if it also checked for admin rights and gave one of the nice "you need admin rights" messages that are in the 0x0409.ini file, or if I could change this unfriendly, useless message, but neither seems possible. I don't want to go back to InstallShield 12 because I need to set some file permissions. The only way I've found to get around this is to allow for multiple install instances, but I really can't do that--I have a lot of users who wouldn't be able to handle that extra complication.

HELP!

Thanks,
Ann
Labels (1)
0 Kudos
6 Replies
Flexera MichaelU
Flexera

Re: How to check for admin privileges in InstallScript

Typically on modern version of Windows (Vista and higher), you should handle this by setting the launcher to run as administrator. This is then indicated to the user before launching your install because of the shield icon on it.

Are you concerned that you will have a lot of users who are not administrators trying to install your application on machines which already have it installed? We find that typically users who are not administrators are in environments where their software is installed for them.
0 Kudos
Annie_B
Pilgrim

Yes, it really is a problem

I changed the setup.exe properties in the Release to Administrator too, and the non-admin user still gets the same unhelpful message. I thought maybe I wasn't changing the property correctly, so I changed the size of the init dialog as well. The init dialog size changed, but I still didn't get any "must run as admin" message.

We have some of the world's most unsophisticated users. It's educational software used primarily by beginning college students. For a good number of them, this is the first software they've ever tried to install on their own, and more of them than you might expect have a hand-me-down computer that still has the child's user settings that they had when it was their parent's computer--equals without admin privileges. So it may be more of a problem for us than for most companies.

So you're telling me that the function that dealt with this problem well in InstallShield 12 purposely no longer works in InstallShield 2010?
0 Kudos
Annie_B
Pilgrim

Sorry I wasn't clear!

Just realized I wasn't specific enough in my last post. On Vista and higher, it DOES indeed work to change the setup.exe setting. My problem is on XP, which is what a lot of the kids are using when they inherit a parent's older computer. I could switch back to InstallShield 12 and create an installer just for XP users, but a lot of these kids aren't entirely clear on what system they're using, so I fear that we'd still have a lot of tech support incidents because of this problem because they wouldn't be able to figure out which installer they were supposed to use. We're a very small company with only one tech support person for about 25,000 users, so it's really necessary to keep everything as simple as possible with our population, sad to say.

Ann
0 Kudos
Flexera MichaelU
Flexera

Re: How to check for admin privileges in InstallScript

I've got good news. You just need to do your check earlier, in OnSetUpdateMode (under category Initialization), or otherwise change the code in OnSetUpdateMode to avoid this undesired behavior. The message you are seeing comes from the string in there with identifier IDS_IFX_ERROR_UPDATE_NO_INSTALLED_VERSION, so put your code before that.

(As a side note, I'm a little surprised that a user with such limited knowledge is expected to know what to do when they see the message you quoted; perhaps you use a more informative message in your actual product. Smiley Happy)
0 Kudos
Annie_B
Pilgrim

Re: How to check for admin privileges in InstallScript

You're a life-saver! This works! Exactly what I needed, and in time to put it on the CD master too. Many, many, many thanks.

As for the message--no that's not the real message. After all, these kids have already picked the wrong choice in the official-looking message that gives them the choice of installing as a non-admin user or as administrator but tells them which choice is more likely to work, so they've proven they're not the brightest in their class. I'm always tempted to tell them they should just call their parents to get the admin password, since that's likely what they really need to do, but so far, I've resisted that temptation!

Anyway, THANKS! I'm a very happy camper now.

Ann
0 Kudos
mumbles
Pilgrim

Re: How to check for admin privileges in InstallScript

Where is this located? OnSetUpdateMode ?

Do you mean she should continue to runt he IS script at the top, and then sequnce at a certain point? I don't understand what OnSetUpdateMode is or where it is to set. Please advise.
0 Kudos