Using PowerShell on command line to start a server with admin privileges

Posted on

QUESTION :

I have an agent.exe, when run with Windows PowerShell, starts a server on port 18383:

> powershell -Command ".agent.exe"
⇨ http server started on [::]:18383

Above command, pops up a security dialog like this:

PowerShell runs executable


Following this post and its comments, I try to run agent.exe with PowerShell with admin privileges, but I cannot figure out how to compose my command. Can anybody help?

ANSWER :

Problem is fixed by using this command to run as admin:

> powershell -Command "Start-Process '.agent.exe' -Verb runAs"

Run with admin privileges

Leave a Reply

Your email address will not be published. Required fields are marked *