Starting from a non-elevated PowerShell, I want to be able to launch a command prompt as Administrator and then run a particular tool as Administrator, ultimately to be used for a right-click menu option.
I have tried this so far:
Start-Process cmd -ArgumentList '/k tool.exe' -Verb RunAs
While this does launch a command prompt as Administrator, it runs tool.exe first in a non-elevated command prompt and then switches to an Administrator command prompt. How can I get this to run tool.exe as Administrator?
Edit: As @mklement0 pointed out, the command prompt actually was being run as Administrator, it just wasn't reflected immediately in the window title (possibly a bug?). Thus, the sample above does actually work as expected.