Page 1 of 1

Run As Administrator

Posted: Thu Feb 08, 2007 6:14 am
by cdh
When you right click on a shortcut in Vista, there's an option to Run As Administrator. Does anyone know how to set this characteristic to a shortcut when it is created with IA so that it runs as Administrator without the user having to right click on the icon and select that option?

Posted: Fri Feb 09, 2007 9:55 am
by H4nd0
You can't change the shortcut. You need to inject an application manfest into your EXE that makes a request to the UAC to elevate your privileges.

Here's how you do it:

http://softlogger.com/5588/most-popular ... t-exe.aspx

More info on UAC elevation here:

http://technet.microsoft.com/en-us/wind ... 06021.aspx

Including the elevation manifest won't stop UAC prompting though. You need to turn UAC off in order to avoid prompting. You can do this simply like this in IA:

Run Program reg.exe ADD HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System /v EnableLUA /t REG_DWORD /d 0 /f (WAIT)

You will then need to reboot.

Posted: Fri Feb 09, 2007 1:41 pm
by MichaelNesmith
Very interesting. Presumably the turning off of UAC will require a separate UAC prompt? Or will it not require that prompt when the InstallAware setup has been previously blessed by UAC?

Posted: Sat Feb 10, 2007 4:53 am
by H4nd0
If you do it from within the installer you won't see a UAC prompt since your installer is already running in an elevated state (Vista does this for you automagically). All you will see is a security warning in the tool tray but the change won't come into effect until you reboot.

Posted: Sat Feb 10, 2007 2:17 pm
by MichaelNesmith
Ah, true. However if setup is running without admin privileges, then this approach would fail, as in that case UAC blessing will not occur.

Posted: Tue Feb 20, 2007 10:28 am
by H4nd0
Most apps require admin privs before installation anyway since the will have limited access to the machine irrespective of whether UAC is active or not.

Our installer requires admin privs. However, on Fista as part of the certification process your app is supposed to _not_ require admin privs. Fat chance when you want to do anything fancy under the hood.

Posted: Thu Mar 15, 2007 8:20 am
by Anthony Wieser
H4nd0 wrote:You can't change the shortcut. You need to inject an application manfest into your EXE that makes a request to the UAC to elevate your privileges.

Here's how you do it:

http://softlogger.com/5588/most-popular ... t-exe.aspx


I've just tried adding a manifest using the following steps in a batch file:

miabuild myproject.mpr
mt.exe -manifest myproject.exe.manifest -outputresource myproject.exe;#1
signcode -cn "My Company Cert Name"

etc, but after the mt.exe stage, the output of the miabuild is truncated to around 260 KB.

Is the InstallAware exe not a standard windows exe file that mt can operate on? I'm using InstallAware 6.4

Anthony Wieser
Wieser Software Ltd

Posted: Mon Mar 26, 2007 1:14 pm
by dbsoft
Getting the same issue with the miabuild being truncated to 217K

Did you get a reply from Tech Support directly?

Regards