admin-rights

How to run command line with admin right in C# [duplicate]

巧了我就是萌 提交于 2020-12-13 07:51:44
问题 This question already has answers here : Elevating process privilege programmatically? (5 answers) Execute several elevated commands in shell (or similar) (1 answer) How to run multiple lines in cmd as administrator using C#? (2 answers) How do I make a console app always run as an administrator? (3 answers) Closed 3 years ago . I have referenced some other topics and it comes up the following coding, yet it doesn't work. I allow it creates command window and use "/k" argument keeping the

Running Visual Studio without admin rights

ε祈祈猫儿з 提交于 2019-12-30 08:32:16
问题 We work on XP Pro workstations and use Visual Studio 2008 & 2010 to develop winforms, web and web services against local IIS and SQL Express instances. We currently have local admin rights on our main machine account. The proposal is to move to a low rights account for our amin login but to have another local account with local admin rights that we then use to elevate where needed. Are there any issues developing and debugging under this setup that would affect developer productivity? 回答1:

Java - Executing exe with Admin Rights [duplicate]

霸气de小男生 提交于 2019-12-11 21:19:21
问题 This question already has answers here : Java: run as administrator (8 answers) Closed 5 years ago . I'm currently developing a study tool which groups several portable system management tools (mainly sysinternal tools). I have a simple frame with a JButton. What am I trying to do? - Along with my java file i have an exe file (for example purposes let's use config.exe) which needs elevated rights to run. After the user clicks on the button how can i do this execute this file? EDIT: I just

How do I install a windows service that runs as an administrator?

不羁岁月 提交于 2019-12-07 09:16:34
问题 I've written an installer that installs a windows service (A) that needs to start/stop another service (B). However, when A tries to start/stop B, I get this exception: System.InvalidOperationException: Cannot open MyService service on computer '.'. ---> System.ComponentModel.Win32Exception: Access is denied The installer installs the service as a local service, and it requests admin rights via the UAC pop-up, which I grant. I've also added an app.manifest file to the service that is set to

How do I install a windows service that runs as an administrator?

大憨熊 提交于 2019-12-05 14:28:50
I've written an installer that installs a windows service (A) that needs to start/stop another service (B). However, when A tries to start/stop B, I get this exception: System.InvalidOperationException: Cannot open MyService service on computer '.'. ---> System.ComponentModel.Win32Exception: Access is denied The installer installs the service as a local service, and it requests admin rights via the UAC pop-up, which I grant. I've also added an app.manifest file to the service that is set to ask for admin rights: Yet I'm still getting that error. This is how I start the service (stopping is the

.NET Start Process with higher rights

六眼飞鱼酱① 提交于 2019-12-04 19:42:46
问题 I am trying to execute a program with admin rights through a C# application, which gets invoked with user rights only. Code ProcessStartInfo psi; try { psi = new ProcessStartInfo(@"WINZIP32.EXE"); psi.UseShellExecute = false; SecureString pw = new SecureString(); pw.AppendChar('p'); pw.AppendChar('a'); pw.AppendChar('s'); pw.AppendChar('s'); pw.AppendChar('w'); pw.AppendChar('o'); pw.AppendChar('r'); pw.AppendChar('d'); psi.Password = pw; psi.UserName = "administrator"; Process.Start(psi); }

.NET Start Process with higher rights

懵懂的女人 提交于 2019-12-03 14:21:32
I am trying to execute a program with admin rights through a C# application, which gets invoked with user rights only. Code ProcessStartInfo psi; try { psi = new ProcessStartInfo(@"WINZIP32.EXE"); psi.UseShellExecute = false; SecureString pw = new SecureString(); pw.AppendChar('p'); pw.AppendChar('a'); pw.AppendChar('s'); pw.AppendChar('s'); pw.AppendChar('w'); pw.AppendChar('o'); pw.AppendChar('r'); pw.AppendChar('d'); psi.Password = pw; psi.UserName = "administrator"; Process.Start(psi); } catch (Exception ex) { MessageBox.Show(ex.Message); } It does start winzip, but only with user rights.

What does '__COMPAT_LAYER' actually do?

萝らか妹 提交于 2019-12-03 04:23:05
问题 Recently, i was trying to give my application administrator rights without system asking for "Do you want to give administrator rights?" and i found a way which is working perfectly. Solution I Found I created a bat file named nonadmin.bat and wrote the below code in it cmd min C set __COMPAT_LAYER=RunAsInvoker && start %1 and if we drag any exe on it, it gives them administrator rights (before it was not letting me access environment variables without it but after draging the file on bat it

Cross-platform way to check admin rights in a Python script under Windows?

你说的曾经没有我的故事 提交于 2019-12-02 20:38:08
Is there any cross-platform way to check that my Python script is executed with admin rights? Unfortunately, os.getuid() is UNIX-only and is not available under Windows. import ctypes, os try: is_admin = os.getuid() == 0 except AttributeError: is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0 print is_admin Try doing whatever you need admin rights for, and check for failure. This will only work for some things though, what are you trying to do? It's better if you check which platform your script is running (using sys.platform ) and do a test based on that, e.g. import some hasAdminRights

What does '__COMPAT_LAYER' actually do?

▼魔方 西西 提交于 2019-12-02 17:37:35
Recently, i was trying to give my application administrator rights without system asking for "Do you want to give administrator rights?" and i found a way which is working perfectly. Solution I Found I created a bat file named nonadmin.bat and wrote the below code in it cmd min C set __COMPAT_LAYER=RunAsInvoker && start %1 and if we drag any exe on it, it gives them administrator rights (before it was not letting me access environment variables without it but after draging the file on bat it did work). Question Now my question is:- What actually '__COMPAT_LAYER' means and what does it do? How