0

I sometimes use psexec to connect to our windows domain users' computers from remote. What I want to do is to run some programs with non-admin domain user's account (e.g. currently logged in user) and not to enter that user's password. I did try "runas" but it does not work as I want. Note: I use the domain administrator's account to connect.

Is there a command like $ su [username] -c "somecommand" in windows 7 or 8 or 10?.

  • What do you need to run as the local user that you couldn't run with the more privileged domain admin? If you need to run something as the local user would it not be more appropriate to create a scheduled task to run immediately after creation on the target machine? The same task you're calling from PsExec will then run as a scheduled task on the remote machine but use the current user's credentials... – Kinnectus Sep 7 '15 at 7:16
  • I would like to start a GUI program on the remote machine for current user instead of him/her. This is necessary for daily jobs not just after creation of the workstation. We solve this by creating gpo for task scheduler (takes some time) but sometimes it is needed immediately. – ozy Sep 7 '15 at 7:40
  • OK, that's fine :) Just wanted to clear up the use case to get some context. forum.sysinternals.com/… have a read of the response here... you should be able to just run the PsExec command and omit the -u and -p switches and the command should run as the currently logged in user :) if your omit the -u and -p switches, however, and your script calls a UNC location then the connection will fail as it requires authentication to be passed... – Kinnectus Sep 7 '15 at 7:46
  • psexec.exec -i -d \\TARGETPC notepad.exe seems like working but GUI becomes black. When I tried it with MS Word, it throws an exception and dies. When I enter -u flag and enter password everything works well but what I want is to do it without entering user password beacuse nobody wants to give his/her password everytime you do something on their computer. – ozy Sep 7 '15 at 8:10
  • Try putting the number one after -i so -i 1 -d ... - this runs the program but it runs minimized... I'm trying to find the right switch to run program in normal window. The number 1 is the remote user's session ID - so the number might not be 1, but most of the time, if they're the only logged in user, it'll be `. – Kinnectus Sep 7 '15 at 8:35

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.