uac

Start a process as user from an process running as admin

放肆的年华 提交于 2019-12-10 13:57:35
问题 I want to start another program which runs as user from a program running as administrator. The problem is that the second program needs to use outlook, which is not possible if the program runs as admin. The main program needs to run as admin. I did already come up with this two solutions: Process.Start("cmd.exe", @"/C runas.exe /savecred /user:" + Environment.UserDomainName + "\\" + Environment.UserName + " " + "\"SomeProgram.exe" + "\""); or Process.Start("explorer.exe", "SomeProgram.exe")

How-To install a service on Windows to be managed by any user

戏子无情 提交于 2019-12-10 11:47:34
问题 I am looking forward to install a service on Windows (Windows 7 / Windows 8). Though the service would be initially installed by "administrator", but it should be installed in such a fashion that any user account on that local machine can Start / Stop / Restart it. Tried changing "Log On As" to Network Services, but did not help. Tried Subinacl.exe, but that is not feasible due to architecture design of installer (which does not allow installing any external applications). Issue is simple ->

How does one run a program at startup that requires UAC elevation?

丶灬走出姿态 提交于 2019-12-10 11:36:17
问题 I have a program that monitors malicious files and deletes them. However it needs administrator rights to run. This program runs at startup, however the UAC popup is annoying for end users, especially if it appears every time the user logs in. Anyway, I am wondering if there is a way to run the program with administrator rights at startup with out nagging the user with the UAC popup. P.S: Disabling UAC is not a good idea because of security issues for the users. 回答1: You cannot. Windows Vista

UAC: Manifest file is ignored

有些话、适合烂在心里 提交于 2019-12-10 10:58:01
问题 One of my Executables writes some configuration into a XML file to C:\Program Files\MyApp\config.xml. It needs to run as Administrator on Vista / Server 2008, otherwise the OS won't let it write to that location. I included a manifest file named config.exe.manifest, to automatically request administration rights at launch. Here's my manifest file: <?xml version="1.0" encoding="utf-8"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <trustInfo xmlns="urn:schemas

Windows 7 folder sharing API

≡放荡痞女 提交于 2019-12-10 10:45:15
问题 I wonder if it's possible to programmaticaly share folders in Windows 7 while running in restricted logon session: 1) NetShareAdd returns ERROR_ACCESS_DENIED. 2) Command line net share says the same. 3) But explorer has no problems creating new shares without invoking UAC. How does it do that? Any help will be greatly appreciated. 回答1: UAC in windows 7 is less strict than it was in Vista. Windows 7 regards Explorer as a trusted application so it will silently create the share without a UAC

Show UAC prompt when launching an app

狂风中的少年 提交于 2019-12-10 10:20:45
问题 I have an app which needs administrator privileges to do some things. I'd like to just show the UAC prompt when it starts, and then be elevated. I'm not sure how to do this, but I'm hearing about things like manifests and whatnot but not seeing a plain answer anywhere. 回答1: You need an app manifest that demands elevated privileges. Here's a quote from a blog that answers this: First, you can create a manifest file by adding an “Application Manifest File” Item to your project (default name:

Windows Service starting/stopping another service

我的梦境 提交于 2019-12-10 10:19:04
问题 I have a slight problem with a service I have written in C++. The service itself functions correctly and is running under the SYSTEM account. During one point of execution, I have to start or stop another service. This, however, is not working. The call to OpenService() returns error code 5, which is "Access denied". To give a little bit more detail: I have to start an own time provider service that tries to open port 123 on a network adapter, and this port is often already opened by the

Execute code in another users context

心已入冬 提交于 2019-12-10 03:32:06
问题 I have an app with a manifest that requires running as administrator, but part of the app is to map a drive using WNetAddConnection2 which I believe requires it to be run in the normal user context due to credentials etc. Is there a way to execute this bit of code in the normal user context without creating a separate process. EDIT From the comments I have got this far but it doesnt work. I expected it not to as I dont really understand quite how I should use this. Perhaps it best if I open a

Unable to Create or Write to a file as standard user

时间秒杀一切 提交于 2019-12-09 23:57:42
问题 My application creates a log file when it connects or disconnects a server. This works well win win XP. There are no issues while I run it as admin in Vista and Win 7. But if I run this as a standard user in Vista or Win7 then it fails to create the log file, and I know this is for UAC. But how can I bypass this situation so that my app will run as admin . DO I need to add any registry entry while installing my application so that it will always run as administrator. 回答1: If you really want

C# .NET - how to determine if directory is writable, with or without UAC?

偶尔善良 提交于 2019-12-09 17:53:45
问题 I'm working on a piece of software that needs to copy a file to a given directory on the filesystem. It needs to work on both UAC-aware OSs (Vista, 7) as well as XP. To get around the issue of writing to a directory where UAC elevation is required, the app actually kicks off another process with a manifest that states that UAC is required. This generates the prompt and then does the copy when the user confirms. From what I can see, a directory can have three different logical permission