views:

653

answers:

4

I'm running Visual Studio 2008 on Windows 7. When I try to attach to a process, VS tells me to restart under different credentials (with elevated permissions).

So I have to restart VS and run it as Administrator. Is there a way to set it up so VS always starts with Admin privileges?

alt text

+2  A: 

shortcut Properties -> Compatibility tab -> set Run this program as an administrator checkmark.

alt text

Shaji in comments posted How to Run a Program as an Administrator in Windows 7 article link.

Most useful(as for me) is to use keyboard shortcut CTRL+Shift while opening the program.

Alex
Here is a nice tutorial on how this can be done in multiple ways http://www.sevenforums.com/tutorials/11841-run-administrator.html
Shaji
@Shaji, thanks for the link
Alex
+2  A: 

Personally (and I don't want to start a religious war on either side here), on any development rig, I always disable UAC. Then, on your test machine, ensure UAC is on and test as normal.

During development, there are an awful lot of tasks which require admin rights, so it's generally easier to just disable UAC.

Jaymz
http://www.sevenforums.com/tutorials/299-user-account-control-uac-change-notification-settings.html
dev.e.loper
See also http://stackoverflow.com/questions/451809/how-to-configure-visual-studio-not-to-give-uac-prompt-on-each-run
Suma
A: 

Hello,

If you always run Visual Studio as an administrator you are going to get the User Access Control warning every time you start it, even if you are logged in as an administrator to Windows. Obviously you can just click ‘OK’ to dismiss this warning, but it may tempt you to turn User Access Control off.

Note that this is true only if Vista’s User Account Control (UAC) is turned on. Many developers turn UAC off, and in this case Vista behaves in the same way as earlier versions of Windows with regard to starting Visual Studio: if you are logged in as an administrator then Visual Studio will by default run with administrative privileges.

The Administrator Account

Vista also has an account called ‘Administrator’ which behaves differently from other administrator accounts. In fact it behaves like administrator accounts in earlier versions of Windows, in that all programs launched when using it run with administrator privileges by default. There’s no need to specifically set up the program as described above.

As a developer your really shouldn’t need to use this account: you can develop with administrator privileges using the techniques described in this article.

However you may have occasions when you aren’t sure whether a program is failing because of some coding error or simply because a process is being launched with insufficient privileges. In these cases it may be useful to use the Administrator account temporarily to simply rule out a problem with privileges. Note that if you work for a large organization they are almost certainly not going to let you near this account, however: this is really only useful for those developing at home.

Using the Administrator Account

To enable the Administrator account start a command prompt with administrator privileges as described above (type ‘cmd’ in the Start Search box and hit Control-Shift-Enter). Then enter:

net user Administrator /active:yes

This has a blank password by default. To set a password use:

net user Administrator {password}

You can now log off and log on as the Administrator. Once you are done with any testing you should disable this account again as below

net user Administrator /active:no

Note that disabling the account does not clear the password. However if you forget it you can always set it again as above when you come to use the account again (provided you have access to at least one account with administrator privileges).

Hope this helps...

Muse VSExtensions
A: 

You only need to elevate VS when you are attaching to an elevated process. Not in general. Always launching VS with elevated permissions sounds like a real drag to me. YMMV I guess.

Kate Gregory