cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rojomoke
Level 3

Running under User Access Control

Hello,
For historical reasons, we've always required that our customers install and run our application with UAC turned off, but we're now seeking to change that.
The problem is, we have customised scripts running NGen and RegAsm commands that will need to be granted elevated privileges at install time.
Is there a flag we can set in InstallShield to enable this?

Also, as we distribute both setup.exe and .msi formats, is there any flag we need to specify to msiexec?

Thanks
Labels (1)
0 Kudos
(1) Reply
sdnelson
Level 5

In your release config in the setup.exe tab set Required Execution Level to Administrator. There is no way to require Admin rights without an exe bootstrap so for the MSI you just have to tell them to launch msiexec from an Admin command prompt. To stop the people that don't follow instruction from running the msi without admin rights, you can create a custom action to check for admin rights and then abort if they arent running as admin. I'm not sure of a way to check in Installscript but you could create a DLL to do the check and return true or false to your install. Here is a C# example:

public bool IsElevated
{
get
{
return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);
}
}



Alternatively, when you launch your scripts you could use LAAW_OPTION_USE_SHELLEXECUTE and set LAAW_SHELLEXECUTEVERB = "runas" before calling LaunchApplication. This should allow the user to provide Admin credentials to prevent being blocked by UAC.
0 Kudos