Click here to Skip to main content
15,747,637 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to run bat file on server having credentials in windows application

What I have tried:

I have tried using WMI class but it did not work .
I think i am doing somthing wrong .
Posted
Updated 29-Jan-17 18:51pm
Comments
Suvendu Shekhar Giri 30-Jan-17 0:27am    
Share what have you tried and what was issue with that.

1 solution

for executing bat file with .net code, you can refer to this URL Executing Batch File in C# - Stack Overflow[^]
 
Share this answer
 
Comments
Member 12955129 30-Jan-17 11:49am    
Sir I want to run batch file on remote machine.
I know the credentials of remote machine
Ashwin. Shetty 30-Jan-17 12:29pm    
I have not tried it but psexec should work in your scenario. If you have control to install a service on removed machine then try Windows service which Can host wcf service. You Can implementation security on top of wcf service. Your wcf service will validate the request and than execute bat on separate thread
Member 12955129 31-Jan-17 1:46am    
I don't have permission to host windows service on server.

Ashwin. Shetty can you provide psexec c# sample code.
Ashwin. Shetty 31-Jan-17 5:14am    
https://technet.microsoft.com/en-us/sysinternals/pxexec.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900