elevated-privileges

Request Windows Vista UAC elevation if path is protected?

て烟熏妆下的殇ゞ 提交于 2019-11-26 18:53:14
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 elevation mid-execution? Adrian Clark The best way to detect if they are unable to perform an action is to attempt it and catch the UnauthorizedAccessException . However as @ DannySmurf correctly points out you can only elevate a COM object or separate process. There is a demonstration application within the Windows SDK Cross Technology Samples called UAC

Run ExeCommand in customAction as Administrator mode in Wix Installer

江枫思渺然 提交于 2019-11-26 18:17:57
问题 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 administrator. I have googled and found the keywords Elevated Privileges and impersonate might help me. <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated"></Package> As you can see above, I used the

Launching an administrative interactive process when a standard user is logged on

北城以北 提交于 2019-11-26 17:49:43
问题 I have a system service which creates a helper interactive process as administrator so that it can access some desktop-related resources, including the BlockInput() function and NVIDIA's NVAPI functions, which cannot be run from a service. When the logged on user was a member of Administrators, the following worked: Set privilege levels, including SE_TCB_NAME Get active session ID with WTSGetActiveConsoleSessionId() Get logged on user from session ID with WTSQueryUserToken()

How to set 'Run as administrator' on a file using Inno Setup

时光毁灭记忆、已成空白 提交于 2019-11-26 16:36:22
I'm creating an installer using Inno Setup. As part of the install process I'm installing Tomcat. On Windows 7 I suffer from the problem described here: http://blog.paulbouwer.com/2010/10/23/the-case-of-the-annoying-tomcat-6-monitor/ I can fix it by manually setting the 'Run as administrator' on tomcat7w.exe (the issue and the root cause is the same for tomcat7 as well), but I don't know how to do it through Inno Setup. I'm finding threads that explain running some_program.exe as administrator, but here the program is started when the Tomcat service starts (e.g. on machine start-up), so I need

Avoiding UAC but launching an elevated process using a windows service

你。 提交于 2019-11-26 14:25:12
问题 I have a non-interactive service running as a the privileged SYSTEM user on Windows machines, and I need it to launch a given executable as an elevated process. I have managed to launch a child process as SYSTEM, using WTSGetActiveConsoleSessionId(), finding a system process and duplicating it's token. Similarly, I can launch a non-elevated process as a regular user. But I need to launch the process as the regular user, but with elevated privileges - so that I don't have to show UAC, but the

Elevating privileges doesn&#39;t work with UseShellExecute=false

会有一股神秘感。 提交于 2019-11-26 08:29:49
问题 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\", }; var process = new Process { StartInfo = info }; process.Start(); and this works: var identity = new WindowsPrincipal(WindowsIdentity.GetCurrent()); identity.IsInRole(WindowsBuiltInRole.Administrator); // returns true But UseShellExecute = true creates

How to make a batch file delete itself?

落花浮王杯 提交于 2019-11-26 08:08:09
问题 Is it possible to make a batch file delete its self? 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. 回答1: npocmaka's answer works, but it generates the following error message: " The batch file cannot be found. " This isn't a problem if the console window closes when the script terminates, as the message will flash by so fast, no one will see it. But it is

How to run vbs as administrator from vbs?

流过昼夜 提交于 2019-11-26 06:39:50
问题 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 → runScript.vbs). If I start script with classic CMD the computer isn\'t renamed. My idea is I start script with user rights, without parameters and if there is no parameter, the script re-runs itself with admin rights and with parameter as identificator \"I\

How to programmatically gain root privileges?

╄→尐↘猪︶ㄣ 提交于 2019-11-26 05:30:35
问题 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 to know the identity (uid) of the \"real\" user. Is there a way to mimic the \"sudo\" command behavior (ask for user password) to temporarily gain root privileges and perform the particular task ? If so, which functions would I use ? Thank you

How to set &#39;Run as administrator&#39; on a file using Inno Setup

烈酒焚心 提交于 2019-11-26 04:51:14
问题 I\'m creating an installer using Inno Setup. As part of the install process I\'m installing Tomcat. On Windows 7 I suffer from the problem described here: http://blog.paulbouwer.com/2010/10/23/the-case-of-the-annoying-tomcat-6-monitor/ I can fix it by manually setting the \'Run as administrator\' on tomcat7w.exe (the issue and the root cause is the same for tomcat7 as well), but I don\'t know how to do it through Inno Setup. I\'m finding threads that explain running some_program.exe as