Questions tagged [elevated-privileges]

Elevated privileges are higher privileges, offered by an operating system, usually higher than normal user's privileges.

Elevated privileges are higher privileges, offered by an operating system. They are usually higher than normal user's privileges (for example, administrator privileges are regarded as elevated privileges).

398 questions
979
votes
12 answers

How do I force my .NET application to run as administrator?

Once my program is installed on a client machine, how do I force my program to run as an administrator on Windows 7?
Gold
  • 60,526
  • 100
  • 215
  • 315
267
votes
19 answers

How can I auto-elevate my batch file, so that it requests from UAC administrator rights if required?

I want my batch file to only run elevated. If not elevated, provide an option for the user to relaunch batch as elevated. I'm writing a batch file to set a system variable, copy two files to a Program Files location, and start a driver installer. If…
PDixon724
  • 2,673
  • 3
  • 15
  • 4
224
votes
16 answers

How to request Administrator access inside a batch file

I am trying to write a batch file for my users to run from their Vista machines with UAC. The file is re-writing their hosts file, so it needs to be run with Administrator permissions. I need to be able to send them an email with a link to the…
skb
  • 30,624
  • 33
  • 94
  • 146
87
votes
14 answers

How to run script with elevated privilege on windows

I am writing a pyqt application which require to execute admin task. I would prefer to start my script with elevate privilege. I am aware that this question is asked many times in SO or in other forum. But the solution people are suggesting is to…
sundar_ima
  • 3,604
  • 8
  • 33
  • 52
48
votes
10 answers

How to make a batch file delete itself?

Is it possible to make a batch file delete itself? I have tried to make it execute another file to delete it but this did not work. Does any one know how I could do it? The batch file I am using is elevated. My OS is Windows 7 32 bit.
09stephenb
  • 9,358
  • 15
  • 53
  • 91
41
votes
4 answers

How to use ServerManager to read IIS sites, not IIS express, from class library OR how do elevated processes handle class libraries?

I have some utility methods that use Microsoft.Web.Administration.ServerManager that I've been having some issues with. Use the following dead simple code for illustration purposes. using(var mgr = new ServerManager()) { foreach(var site in…
Josh
  • 2,740
  • 3
  • 27
  • 41
41
votes
14 answers

Running IIS Express with admin privileges

This has been asked before but was closed as "Not a real question" https://stackoverflow.com/questions/7450813/how-to-run-a-site-with-administrative-privileges-in-iis-express-7-5 However I think it is a genuine question as I also need to do this,…
Morvael
  • 3,478
  • 3
  • 36
  • 53
34
votes
7 answers

How to programmatically gain root privileges?

I am writing some software (in C++, for Linux/Mac OSX) which runs as a non-privileged user but needs root privileges at some point (to create a new virtual device). Running this program as root is not a option (mainly for security issues) and I need…
ereOn
  • 53,676
  • 39
  • 161
  • 238
33
votes
2 answers

Make Inno Setup installer request privileges elevation only when needed

Inno Setup installer has the PrivilegesRequired directive that can be used to control, if privileges elevation is required, when installer is starting. I want my installer to work even for non-admin users (no problem about installing my app to user…
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
30
votes
1 answer

Run ExeCommand in customAction as Administrator mode in Wix Installer

I am new to wix installer. I have developed a set-up using wix installer for my application and I need to execute a Custom Action to run a command in cmd.exe. In XP it works fine. But in Windows 8 & 7 the cmd prompt needs to be run as…
Dah Sra
  • 4,107
  • 3
  • 30
  • 69
28
votes
6 answers

How to run vbs as administrator from vbs?

Can anyone help me with running vbs from itself but with administrator rights? I need rename computer with Windows 8 via VBScript, but it's possible only if I run my script through administrator command line (CMD → Run as Administrator →…
Daphnis
  • 437
  • 1
  • 5
  • 14
27
votes
6 answers

Request Windows Vista UAC elevation if path is protected?

For my C# app, I don't want to always prompt for elevation on application start, but if they choose an output path that is UAC protected then I need to request elevation. So, how do I check if a path is UAC protected and then how do I request…
sieben
  • 2,161
  • 4
  • 23
  • 31
23
votes
3 answers

Elevating privileges doesn't work with UseShellExecute=false

I want to start a child process (indeed the same, console app) with elevated privileges but with hidden window. I do next: var info = new ProcessStartInfo(Assembly.GetEntryAssembly().Location) { UseShellExecute = true, // ! Verb = "runas",…
abatishchev
  • 98,240
  • 88
  • 296
  • 433
23
votes
4 answers

How do I get WiX installer to request administrative privileges?

We have a program we have developed in house. We are upgrading to use Visual Studio 2012, and so have to leave the Visual Studio installer project behind. InstallShield LE was giving us problems with shortcuts if the application was already…
Opus Krokus
  • 241
  • 1
  • 2
  • 3
20
votes
2 answers

Batch file: Drop elevated privileges (run a command as original user)

I have a batch file that starts with elevated privileges (my installer spawns it), but at a certain point I need to run a command as the original user who started my installer (i.e. drop from the elevated privileges). Is it possible to do so?
sashoalm
  • 75,001
  • 122
  • 434
  • 781
1
2 3
26 27