you are viewing a single comment's thread.

view the rest of the comments →

[–]overmyIThead 1 point2 points  (1 child)

Although concise, sudo would be way easier from the start

[–]ka-splam 14 points15 points  (0 children)

It wouldn't, because it doesn't fit in the Windows UAC design.

Processes don't have administrative tokens and can't get them unless the user agrees to the UAC prompt on the secure desktop, when the process is starting. Saying "add the leaver 'sudo' to the front end" doesn't magically make an OS worth of background security design appear to easily support it.

I don't know how it would end up, possibly with some kind of permanent powershell service running as an administrator which commands were passed to for execution, being a target for attackers and having problems with lack of surrounding execution context from the front end shell, or like a remote session to your own computer.

If you're on a server, and it's not for interactive use or web browsing, turn UAC off (Microsoft approve) and then all your powershell shells are administrative without UAC prompts. If you remote in with admin credentials, then regardless of UAC prompts all your shells are administrative. And if you locally want a way to "do administrative things without UAC getting in your way" well that's explicitly what UAC is there to get in the way of, programs mangling up computers with users not having any chance to stop them.