Psexec "run as (remote) admin"

Elad Benda picture Elad Benda · May 12, 2010 · Viewed 123.6k times · Source

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

Answer

Chisman picture Chisman · Feb 25, 2013

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