Saurabh
Saurabh

Reputation: 29

Batch File execution on remote windows server via batch file on another windows server

I am trying to call a batch file placed on a remote windows server from my windows server. I have freeSSHd installed on the remote server. I tried using putty/plink but of no result.

Syntax of command I am using is:

Putty: start E:\putty.exe -ssh user12@serverIP -pw "abcd12" call sample.bat

Plink: start E:\plink.exe -ssh user12@serverIP -pw "abcd12" cmd.exe -m E://sample.txt

I even tried all variants of above two commands like "-m file.txt" etc. Also I am able to execute batch file via login into putty console but not via calling batch file placed on my windows server.

Upvotes: 2

Views: 15046

Answers (1)

Trigger
Trigger

Reputation: 691

This is how to start remote programs in Windows.

wmic /node:servername process call create "cmd.exe c:\\somefolder\\batch.bat"

Files executed this way are invisible on the remote computer.

For Help

wmic /?
wmic process /?
wmic process get /?
wmic process set /?
wmic process call /?
wmic process call create /?
wmic process /node /?
wmic process /user /?
wmic process /password /?

Upvotes: 5

Related Questions