Is it possible to just run a single command as admin without actually opening a window as admin ?
1 Answers
Is it possible to just run a single command as admin without actually opening a window as admin ?
You can run a command from a standard user account. But when / if the command requires admin credentials to run, it will pop up a sub-window to obtain the admin userid and password.
You can also run a command from the Start Menu. Press Start and type the command. That works.
But you will still be challenged for Admin Userid and Password.
That is the way Windows works in this situation.
So what I have described is not opening an admin window to run a command, but rather to run the command and satisfy the request for admin user id and password.
Scheduled tasks can store the admin credentials and so can run to a schedule without further asking for credentials but that did not seem to be the case here.
So no matter which method above, you do have to supply admin userid and password to run an admin command.
- 49,923
sudogave me an idea for what to look for and it looks likerunas /noprofile /user:Administratoris as close as I'll get. – alex Provencher Jan 16 '22 at 03:28sudoso I wouldn't actually have to open a new Powershell windows as admin. I know I will still get the pop-up asking permission. There is a way to avoid it, however, by adding something to the registry. Butrunasdoes what I was looking for just fine. – alex Provencher Jan 17 '22 at 01:19sudois all I was looking for. I don't mind having to confirm, just didn't want to have to open a whole new shell to run SU commands. – alex Provencher Jan 17 '22 at 03:08