Windows Form C# run a command with admin rights without typing credentials

LiLou 0 Reputation points
2023-09-15T13:21:44.5833333+00:00

Hello everyone,

So I'm an IT admin and some users have been complaining about their computer running slower and slower each time : turns out it comes from the "Quick Start" feature (I think it's exclusive to Lenovo) that keeps the processor up when you want to turn it down.

I figured out you can use "powercfg /h off" as an admin to disable this option (or "Powercfg /h on" to turn it on)

So I wanted to make a Windows Form program with two buttons to enable/disable the Quick start, but you need to be an admin to run this command.

That's why I wanted to know if there is a way to do this program so the users can choose if they want to disable or not the Quick Restart without me typing the admin credentials each time.

Thank you!

Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,293 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,829 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 84,301 Reputation points
    2023-09-15T13:33:14.5833333+00:00

    You could add a Manifest file with

    "requireAdministrator"

    instead of

    "asInvoker"


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.