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: Detecting if RunAsAdmin w/InstallScript
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
‎Dec 16, 2011
09:41 AM
Detecting if RunAsAdmin w/InstallScript
I have an InstallScript project that is serving as the entry point for a series of installs to install our project suite. Is there a way that I can detect if the setup has been launched in "Run As Administrator" on Vista or later OSes.
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 16, 2011
02:32 PM
I needed to check for this as well but also have another question. The solution that I found was to check for USER_ADMINISTRATOR as in:
if ! (Is(USER_ADMINISTRATOR, "")) then
else
.
.
endif;
HTH. My question is once you've detected that run as admin was not used, how do you raise an error to prevent other custom actions from executing? My objective is to check for run as admin as early as possible and if False then end the installation.
Thanks.
Cesar
if ! (Is(USER_ADMINISTRATOR, "")) then
MessageBox("You must use the 'Run as administrator' option to install this product", SEVERE);
else
.
.
endif;
HTH. My question is once you've detected that run as admin was not used, how do you raise an error to prevent other custom actions from executing? My objective is to check for run as admin as early as possible and if False then end the installation.
Thanks.
Cesar
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 16, 2011
03:56 PM
Typically I would suggest changing the Required Execution Level setting on the releases view to Require Administrator. If you need to take cslims's approach, usually the abort; statement will help you exit the setup without modifying the system.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 19, 2011
08:10 AM
Thanks for the abort tip Michael, I'll try that. I do have Require Administrator set however due to how AD policies are handled here, the tech does not have local admin permissions on the workstation so simply Require Admin does not do the trick.
Cesar
Cesar