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 for business | Windows Client for IT Pros | User experience | Other
Developer technologies | C#
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 90,686 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.