Psexec “run as (remote) admin”

試著忘記壹切 提交于 2019-12-18 12:18:12

问题


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


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/2816663/psexec-run-as-remote-admin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!