This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Require admin rights for Setup.exe does not work when running Setup.exe from bat file
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 17, 2009
04:51 AM
Require admin rights for Setup.exe does not work when running Setup.exe from bat file
Hi
In our "Basic MSI" project, I set the "Required Execution Level" attribute to Administrator. (In Media->Releases->Setup.exe).
When i click on the generated Setup.exe, a pop up is displayed that asks for administrative rights. So this works well. However, when i create a batch file that only includes the line "Setup.exe" the installation starts immediately (with prerequisites in our case) and the dialog asking for admin rights is not displayed. (Tested on Windows XP, SP2 and SP3)
Is it because what the information to ask for admin rights is somewhere stored in the Setup.ini file, whose settings are not applied when calling the Setup.exe via bat file? Is there a way to ensure the user is always asked for administrative rights at the beginning of the installation?
Thanks in advance for your answer.
In our "Basic MSI" project, I set the "Required Execution Level" attribute to Administrator. (In Media->Releases->Setup.exe).
When i click on the generated Setup.exe, a pop up is displayed that asks for administrative rights. So this works well. However, when i create a batch file that only includes the line "Setup.exe" the installation starts immediately (with prerequisites in our case) and the dialog asking for admin rights is not displayed. (Tested on Windows XP, SP2 and SP3)
Is it because what the information to ask for admin rights is somewhere stored in the Setup.ini file, whose settings are not applied when calling the Setup.exe via bat file? Is there a way to ensure the user is always asked for administrative rights at the beginning of the installation?
Thanks in advance for your answer.
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 21, 2009
02:44 AM
Does anyone have an idea?
Thanks in advance and greetings
Thanks in advance and greetings
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 21, 2009
07:46 AM
Hi,
I faced the same problem a while ago.
Indeed, setup.exe does not check for administrator rights if it is started from the command line or from a batch file.
Maybe it assumes that only administrators would launch it from a batch file, which is a bit of a silly assumption to me.
On top of that, if a user with no admin credential double-click the MSI file itself, this admin check will be simply bypassed, and the installation/deinstallation will start.
So it is safer to implement this check yourself.
To do this, just read the "AdminUser" MSI property. It tells you if the current user has got administrator credentials.
If this property is set, the user has got admin credentials, and you can react, or display a dialog/message accordingly.
Just one more point: This property just tells you if the user is an administrator of the target PC. It does not tell you if setup.exe was "run as administrator" on Win Vista and Win 7. But it should not be a problem, unless your setup explicitely needs to be "run as administrator".
I faced the same problem a while ago.
Indeed, setup.exe does not check for administrator rights if it is started from the command line or from a batch file.
Maybe it assumes that only administrators would launch it from a batch file, which is a bit of a silly assumption to me.
On top of that, if a user with no admin credential double-click the MSI file itself, this admin check will be simply bypassed, and the installation/deinstallation will start.
So it is safer to implement this check yourself.
To do this, just read the "AdminUser" MSI property. It tells you if the current user has got administrator credentials.
If this property is set, the user has got admin credentials, and you can react, or display a dialog/message accordingly.
Just one more point: This property just tells you if the user is an administrator of the target PC. It does not tell you if setup.exe was "run as administrator" on Win Vista and Win 7. But it should not be a problem, unless your setup explicitely needs to be "run as administrator".
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 22, 2009
10:20 AM
Hi
I hoped there was a more elegant solution but it does it for me. Thanks for your answer
Greetings
I hoped there was a more elegant solution but it does it for me. Thanks for your answer
Greetings
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 22, 2009
10:26 AM
The point is:
MSI checks if it can access files for writing at a later stage, if it needs to write/change files during the execute sequence.
So if the end user has no Admin right, and double click the MSI file, it simply bypasses the check implemented in setup.exe, but chances are that MSI returns an error later in the execute sequence.
It is safer to implement the check yourself...
MSI checks if it can access files for writing at a later stage, if it needs to write/change files during the execute sequence.
So if the end user has no Admin right, and double click the MSI file, it simply bypasses the check implemented in setup.exe, but chances are that MSI returns an error later in the execute sequence.
It is safer to implement the check yourself...
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)