Psexec "Run as (Remote) Admin"

I wrote some c# code that uses PSexe. I want it to run a remote exe on a machine connected to my LAN.

That exe creates a new local user. When I run that exe locally on the remote machine (after right click --> "run as Admin") - it works fine. I don;t know how to simulate the right click --> "run as Admin" from Psexec. I have tried the -l flag but it didn't work

2 Answers

Simply add a -h after adding your credentials using a -u -p, and it will run with elevated privileges.

4

Use psexec -s

The s switch will cause it to run under system account which is the same as running an elevated admin prompt. just used it to enable WinRM remotely.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest