How can I start a service from the command line e.g. net start "sql server (sqlexpress2016)"
without running with elevated privileges?
The short answer is "you can't".
But how come then Services services.msc
can start the same service without elevated privileges?
Is there a way to mimic this through the command line?
Clarification:
I am not looking for a way to change the service's security level but more like something on the command prompt like C:\>win-su net start SqlServer2016
. where win-su
has the rights and super powers to automagically recognise me as an admin and raise the security level for the net
process.
services.msc
DOES run elevated; it requests elevation automatically, and gets it silently unless you crank UAC up to 'always notify'. Whereas CMD by itself can't request elevation, although it can run VBS and PS methods that do.services.msc
is set at windows-install time to allow for automatic elevation then. That's fair. I was thinking of dropping this Q and ask another one how to raise privilege through Powershell, without confirmation or admin pwd, just asservices.msc
? I guess I won't since, if I understand correctly, that is not possible without changing UAC or writing script files to execute in elevated mode; which brings me back to square one. If my thoughts are correct, that it cannot easily be done, please write that as an answer so I can acknowledge it.