fifamaniac04
fifamaniac04

Reputation: 2383

How to run as different user without prompting user batch

I have a batch file that runs another batch file as a different user.

I also need to run the calling batch file remotely. Locally I can bypass having to enter the password with the /savecred option but then when I run the batch remotley, I still get prompted for the password but it would appear the connection times out because I'm brought back to the powershell prompt on the machine i'm connecting from.

my batch looks like this:

runas.exe  /env /savecred /user:sqlsvr_dba ".\myBatch.bat"

How can I run the remote batch on my local machine without having to enter the password? I've been trying to use powershell for this.

Upvotes: 3

Views: 12168

Answers (1)

npocmaka
npocmaka

Reputation: 57282

Same question bothered me too :-) I've tried to workaround this with schtasks and eventcreate.Here i posted my solution :

http://ss64.org/viewtopic.php?id=1539

If you want to run the script on a remote machine you can also try with wmic:

http://ss64.org/viewtopic.php?id=1495

Hope these will help you.

Upvotes: 2

Related Questions