View Full Version : Security Priv of Shortcut
How can I make the shortcut that is created by SF set to always run the EXE as an Administrator even if the user is not an Admin. IOW, the EXE needs Admin priv and as long as the user doing the install has admin priv. I would like the shortcut created by SF to be modified to run exe with admin priv....
Thanks
Alec
jassing
10-12-2009, 06:45 PM
Your best bet is to use a manifest.
unfortunately, the Shell.CreateShortcut() does not include any "runas" parameters.
You could trying using the shell command "runas.exe" to launch your exe.
or you could do something with AutoIt and automate the shortcut creation tailoring it exactly as you desire.
Here's some notes I had saved from a similar issue a while back:
If you play around with the run as administrator setting for both the current user and all users on an exe's properties you will see the following keys being set:
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
Note that not all shortcuts point directly at an exe, depending upon whether an application is installed as an advertised application.
Setting a shortcut to run an app as admin, when possible (i.e. the shortcut actually points at an exe) is the same as going into the apps exe properties box and selecting run as admin, thus if it is cmd.exe then you would be setting cmd.exe to run as admin no matter how it were started, so you would need to possibly be resetting it back after it were started to avoid making it run as admin thereafter.
http://msdn.microsoft.com/en-us/library/bb762494(VS.85).aspx
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.