Wednesday, November 25, 2015

windows 7 - Run a batch file on a remote computer as administrator

I am trying to run a batch file (to install some software) on a remote computer. To do this, I am using PSExec.



psexec.exe \\COMPUTER C:\swsetup\install.bat



This works fine, apart from some of the installs fail due to the script not running as an administrator (if I log on, right-click and select "Run as Administrator" the script runs and installs successfully.


I have tried running as administrator with the /runas command, with no luck



psexec.exe \\computer cmd



and then



runas /user:computer\administrator C:\swsetup\install.bat



The system flicks up with "Enter password for account" and then jumps back to the cmd prompt without letting me type the password in. The same issue happens if I try and do



runas /user:myaccount@domain.int C:\swsetup\install.bat



Is there a way around this, or am I going to have to visit the machine, log on, and then run the script on each machine?

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...