administrator

How to create a Run As Administrator shortcut using Powershell

情到浓时终转凉″ 提交于 2019-11-28 09:53:06
In my PowerShell script, I create a shortcut to a .exe (using something similar to the answer from this question ): $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut("$Home\Desktop\ColorPix.lnk") $Shortcut.TargetPath = "C:\Program Files (x86)\ColorPix\ColorPix.exe" $Shortcut.Save() Now, when I create the shortcut, how do I add to the script to make it default to running as Administrator? Jan Chrbolka This answer is a PowerShell translation of an excellent answer to this question How can I use JScript to create a shortcut that uses "Run as Administrator" . In

C# add key to registry to LocalMachine fails

风格不统一 提交于 2019-11-28 08:52:03
问题 I'm trying to add a key to LocalMachine in registry. I'm using this code: System.Diagnostics.Debugger.Launch(); RegistryKey key = Registry.LocalMachine.OpenSubKey("SOFTWARE", true); RegistryKey newkey = key.CreateSubKey("1asdasds", RegistryKeyPermissionCheck.ReadWriteSubTree); newkey.SetValue("ads", "ddsds"); newkey.Close(); I DO run it on Administrator account. I event run it with 'run as administrator", but nothing is added to registry :(. When I change the LocalMachine to CurrentUser ,

Run service with administrator privileges

前提是你 提交于 2019-11-28 04:32:59
问题 I am developing an application that runs as a windows service. I really need the service to have administrator privileges. I tried with the LocalSystem user, and it does not have enough rights. Is this possible? I tried setting requireAdministrator in the app.config. When I do this, the service starts and then immediately stops. I have tried with other administrator accounts as well, but I get the same results. 回答1: You just need to run it as an admin user - set the login correctly in the

Run as administrator: requireAdministrator & ClickOnce + emulating system time

流过昼夜 提交于 2019-11-28 03:09:27
问题 My app uses ClickOnce tehcnology. Today I needed to run it as administrator. I modified the manifest file from <requestedExecutionLevel level="asInvoker" uiAccess="false" /> to <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> However VS cannot compile the project: Error 35 ClickOnce does not support the request execution level 'requireAdministrator'. I think it's impossible to use them at once. Isn't it? I need to change the system time, can I do that in application

Running Program as Administrator at Startup

余生长醉 提交于 2019-11-27 21:03:34
问题 I have a kiosk app and want to run it at startup. The problem here is that when I put Registry value to open it at startup, it doesn't open program as Administrator and so that program doesn't work probably. I'm using Windows 7. Can anyone help me with code to run it as Administrator? Some programs (such as anit-viruses and the viruses themselves) work as Administrator at startup WITHOUT ASKING THE USER TO ACCEPT RUNNING AS ADMINISTRATOR, that's exactly I want to do. Any help is very thanked.

C#.NET: Acquire administrator rights?

浪尽此生 提交于 2019-11-27 12:26:47
Is it possible in a C#.NET application to request administrative rights on a Windows 7 PC? I want to be able to deploy the application via Click Once and have users use it to perform administrative tasks (in this case it is writing registry entries for the main application). http://victorhurdugaci.com/using-uac-with-c-part-1 http://victorhurdugaci.com/using-uac-with-c-part-2 http://victorhurdugaci.com/using-uac-with-c-part-3 *self promotion Extra characters because it must be 30 simply all what you need to do is to add manifest application file to your project simple : right click on the

Adding manifest for admin rights request

别说谁变了你拦得住时间么 提交于 2019-11-27 11:01:14
问题 I have an application that writes program settings to the windows registry that is absolutely necessary so.storing to a file is not an option. To simplify this, I would like to give an "admin privileges" nag screen instead of trying to explain how to right click on the program file/short cut. I found a reasonably good article but I receive a duplicate resource error after adding my own resource file for the manifest. This is supposedly due to a conflict with the internal manifest and to

How do I run a program from command prompt as a different user and as an admin [closed]

你说的曾经没有我的故事 提交于 2019-11-27 09:57:58
问题 I am using "runas" to open command prompt as a different user but that command prompt is not running as an admin. How can I make it run as an admin? UPDATE: I am using Windows Server 2012 UPDATE: I opened cmd for another account by running runas /user:domain\username cmd.exe Then I tried to run some commands in this new prompt but this is not running as an elevated user (even though it has Administrator privileges). 回答1: See here: https://superuser.com/questions/42537/is-there-any-sudo

Using python to open cmd and automatically enter a password

Deadly 提交于 2019-11-27 09:49:00
I've managed to get the cmd being opened by python. However, using runas administrator comes with a password check before cmd.exe is executed. I'm using this to open cmd... import subprocess subprocess.call(["runas", "/user:Administrator", "cmd.exe"]) I'm looking for a way to automatically enter the password into the runas.exe prompt which opens when i run the code. Say if i were to create var = "test" and add it after import subprocess how would i make it so that this variable is passed to and seen as an input to the runas.exe? The solution would require only python modules which are in

Why does ping work without administrator privileges?

折月煮酒 提交于 2019-11-27 09:26:21
as you may know one is unable to create RAW sockets using Windows Sockets without having administrative priviliges. The problem is, that I need to send ICMP messages, thus I need RAW sockets. The Problem: My program needs to run without administrative privileges. That lead me to the question, how does the ping tool send ICMP messages w/o administrative privileges? Although ICMP uses RAW sockets (which require admin rights on Win2K and later), Microsoft circumvents its own security rules to allow its ICMP APIs to get through. As such, don't use RAW sockets directly to send your own ICMP ping