Re: VS Setup Projects and Vista "Run as Administrator"



Additionally, MS say <http://support.microsoft.com/kb/922708>:

"For some program icons, the Run as administrator option is not available on the shortcut menu. For these program icons, follow these steps:
1. Right-click the icon that you use to run the program, and then click Properties. On the Shortcut tab, the Target box contains the location and the name of the program file.
2. Open the folder that contains the program file.
3. Right-click the program file, and then click Run as administrator. User Account Control permission If you are prompted for an administrator password or for a confirmation, type the password, or click Continue."

and

"The Compatibility tab is not available for some program icons. For these program icons, follow these steps:
1. Right-click the icon that you use to run the program, and then click Properties. On the Shortcut tab, the Target box contains the location and the name of the program file.
2. Open the folder that contains the program file.
3. Right-click the program file, and then click Properties.
4. On the Compatibility tab, click to select the Run this program as an administrator check box, and then click OK."

Not exactly much of a solution....

D

David Hearn wrote:
Actually, what I've found is that many shortcuts that get created via installers (ie. appear in the Start Menu) - including Office 2007 shortcuts - don't have Run As Administrator. However, if I go to an .exe and right click, selecting "Create shortcut", the resulting shortcut properties has an additional Compatibility tab, and also has the Run As Admin context menu.

Strangely, my Firefox shortcut on Start Menu *does* have Compatibility/Run As Admin. Maybe a different installer was used?

Doing a quick search though found:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1439749&SiteID=1

Which seems to show how to use an API to alter the shortcut settings.

Hopefully that might help,

David

Eric Johnson wrote:
Actually, most regular shortcuts do have the Run as Administrator. I can manually create a shortcut to my app (and all apps I think) and it appears just fine. It has something to do with how the VS Setups create the shortcuts, but I just don't know what to do about it.

In my case, I don't want the app to be run as administrator each and every time. Just the first time they run it so some other features can be installed and configured.

David Hearn wrote:
Sorry, I mis-read your question.

I believe shortcuts don't support Run As Administrator - only the actual .exe itself. I've never seen Run As Administrator on any shortcut I've tried.

If you want to always run the target of the shortcut as Administrator then set that option on the .exe itself. But I don't know of a way of doing that on an at execution option basis. It's either always As Admin, or not at all.

If you want to get the app to always run as Administrator without having to manually set the option on the .exe, then I believe you need to create a manifest for the .exe which states it must run as Administrator.

Hope that helps,

David

Eric Johnson wrote:
Yes, but I'm referring to the shortcuts my setup creates to my application.

Start...Programs...My App -> c:\program files\blah\blah.exe

The "My App" shortcut doesn't have Run As Administrator in the context menu.

David Hearn wrote:
Eric Johnson wrote:
I have a VS2005 setup project for installing my C# application. Nothing fancy, just copies some files to Program Files and creates Start Menu shortcuts.

On Windows Vista, the "Run as Administrator" is missing from the context menu when I right-click my shortcuts. I need that capability, what makes that disappear? How can I get it to appear?

Thanks,
Eric

MSI files are always run as Administrator (well, they always elevate midway through) so they don't have "Run as administrator" on the context menu.

D
.



Relevant Pages

  • Re: Probs accessing database for users of newly developed Superuse
    ... Using the shortcut on my desktop, I logged in as administrator and held-down ... and noted the WIF and database. ... When I tried to log in as one of the Superusers, ...
    (microsoft.public.access.security)
  • Re: Help with RunAs
    ... >>> I run a number of programs each day using RunAs to run the program ... >>> of the administrator account to something else. ... One can create a shortcut to the desired app, ...
    (microsoft.public.windowsxp.security_admin)
  • Re: VS Setup Projects and Vista "Run as Administrator"
    ... Last night I ended up creating a custom action and creating the shortcut myself with the win32 api. ... the Run as administrator option is not available on the shortcut menu. ... the Target box contains the location and the name of the program file. ... I don't want the app to be run as administrator each and every time. ...
    (microsoft.public.vstudio.general)
  • Re: Help with RunAs
    ... >> of the administrator account to something else. ... I want to run as a domain administrator. ... One can create a shortcut to the desired app, ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Windows Media Center is not showing up...
    ... Also, what happens when you go to the exe and right click, run as administrator? ... shortcut I created with the information that was given to me, ... > the admin but am at a loss as to how to fix this problem. ... >>> Windows Media Center is not showing up under my "All Programs" ...
    (microsoft.public.windows.mediacenter)