Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 744
Elad Benda Avatar asked May 12 '10 07:05

Elad Benda


People also ask

How do I run a PsExec as administrator?

When you run cmd.exe interactively through PsExec under a remote user, you have no way to elevate privileges (as Admin) when the UAC is enabled. To run the commands with the account's elevated token, use the –h option. This option means that all commands will be executed in the “Run as Administrator” mode.

What user does PsExec run as?

Normally PSExec will run with the credentials of the local user that has run the command. By using a domain account instead, you will be able to elevate to that command.

Does PsExec need to be on both computers?

Prerequisites for PsExec File and printer sharing must be enabled on both local and remote computers (TCP port 445 must be open on remote computers). It could be a potential security risk, so make sure you enable this port for the Private profile in the Windows firewall.


1 Answers

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

like image 181
Chisman Avatar answered Sep 19 '22 15:09

Chisman