How to run as different user without prompting user batch

11,811

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.

Share:
11,811

Related videos on Youtube

fifamaniac04
Author by

fifamaniac04

Updated on September 14, 2022

Comments

  • fifamaniac04
    fifamaniac04 over 1 year

    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.