What is the best way to have my windows app run a .bat file on a remote
server? The .bat will need to run as an admin on the remote machine.
Additonally I need for my windows app to wait for the .bat to finish. 7 10114
have a look at the process names pace assuming you have a share or some way
to access the remote machine, this should work.
--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
"Ctal" <wi********@yahoo.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
What is the best way to have my windows app run a .bat file on a remote
server? The .bat will need to run as an admin on the remote machine.
Additonally I need for my windows app to wait for the .bat to finish.
"Ctal" <wi********@yahoo.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
| What is the best way to have my windows app run a .bat file on a remote
| server? The .bat will need to run as an admin on the remote machine.
| Additonally I need for my windows app to wait for the .bat to finish.
|
There is nothing in .NET that makes this possible, even WMI is not able to
start a process as a local admnistrator on a remote system.
Take a look at psexec at
h<ttp://www.sysinternals.com/Utilities/PsExec.html>, this utility can run a
process on a remote system with specified credentials, from your code you
can start psexec using Process.Start.
Willy.
"Alvin Bruney [MVP]" <www.lulu.com/owcwrote in message
news:uq**************@TK2MSFTNGP05.phx.gbl...
| have a look at the process names pace assuming you have a share or some
way
| to access the remote machine, this should work.
|
Alvin, The OP's requirement is to run a batch file remotely, this is not
possible using this namespace. You need a client/server style application
like Sysinternals - www.sysinternals.com psexec.exe to run a process
remotely.
Willy.
I'm not sure what you mean here, the process class can start a local or
remote process. If you mean the bat file, then you are right, it won't start
it but that can be fixed easily by writing a small exe to either call the
bat file or reproduce the bat file functionality in the exe.
--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>
"Alvin Bruney [MVP]" <www.lulu.com/owcwrote in message
news:uq**************@TK2MSFTNGP05.phx.gbl...
| have a look at the process names pace assuming you have a share or some
way
| to access the remote machine, this should work.
|
Alvin, The OP's requirement is to run a batch file remotely, this is not
possible using this namespace. You need a client/server style application
like Sysinternals - www.sysinternals.com psexec.exe to run a process
remotely.
Willy.
"Alvin Bruney [MVP]" <www.lulu.com/owcwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
| I'm not sure what you mean here, the process class can start a local or
| remote process. If you mean the bat file, then you are right, it won't
start
| it but that can be fixed easily by writing a small exe to either call the
| bat file or reproduce the bat file functionality in the exe.
|
| --
|
While the Process class can be used to 'monitor' processes on remote
machines, it can't start (that is run a process remotely) or stop a process
on a remote machine. The Process class call's CreateProcess or
CreateProcessWithLogon, and these API's can only create local processes
(Windows has no API to create processes remotely).
If you have to run a process remotely, you have to resort to WMI, or another
C/S (like Psxec.exe) kind of architecture, here the 'client' requests the
'server' to start a process on a remote server (where it gets created as a
local process).
Willy.
Willy Denoyette [MVP] wrote:
"Ctal" <wi********@yahoo.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
| What is the best way to have my windows app run a .bat file on a remote
| server? The .bat will need to run as an admin on the remote machine.
| Additonally I need for my windows app to wait for the .bat to finish.
|
There is nothing in .NET that makes this possible, even WMI is not able to
start a process as a local admnistrator on a remote system.
Take a look at psexec at
h<ttp://www.sysinternals.com/Utilities/PsExec.html>, this utility can run a
process on a remote system with specified credentials, from your code you
can start psexec using Process.Start.
Willy.
Thanks Willy, that looks promising. The other way I was approaching
this was with ado commands, my remote machine has sql server installed.
I was going to call xp_cmdshell and use that to launch the .bat (or
exe). That works if the SQL service account has the necessary
credentials (in my case it does)
Thanks all for the suggestions.
You are right Willy. I tried unsuccessfully to do this but it would only
fail silently. I swore I did this a couple years ago but when I went back to
check the code, it wasn't a actually a mapped drive, it was
d:\somepath\somefile.
--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>
"Alvin Bruney [MVP]" <www.lulu.com/owcwrote in message
news:uq**************@TK2MSFTNGP05.phx.gbl...
| have a look at the process names pace assuming you have a share or some
way
| to access the remote machine, this should work.
|
Alvin, The OP's requirement is to run a batch file remotely, this is not
possible using this namespace. You need a client/server style application
like Sysinternals - www.sysinternals.com psexec.exe to run a process
remotely.
Willy.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rocket Hawk |
last post by:
Hello All,
I am using windows 2000 server IIS 5.0
i was trying to run bat file from asp page and getting: Access Denied
but when i run the bat file from the command prompt on the local...
|
by: Doug at SAU |
last post by:
I need to run a batch file on a remote machine from an ASP page. I dummied
up a test ASP page as follows:
<%
Set WshShell = Server.CreateObject("Wscript.Shell")
wshshell.run...
|
by: Ian Davies |
last post by:
Hello
I am trying to use php to automate the copying of a file from my remotely
hosted directory to my computer. I have put together the following but it
will only do the copying from one...
|
by: Tola |
last post by:
In my case of study, my teacher gave me a project, after I analysed
the problem I found that I had to used open the file on the other
machine? Please help?
Thank you in advance.
Tola CHROUK
|
by: POnfri |
last post by:
Hi,
I have a problem in a peace of code were i'm doing a file copy using
File.Copy. The Source is local and the target is a remote machine.
Example: File.Copy(C:\temp\hi.txt,...
| |
by: Saracen |
last post by:
I have a major problem with trying to access a foxpro database from a web app.
I have created a web app which is deployed on a server. The foxpro database
(dbf) is on a different server. The...
|
by: Jen |
last post by:
I'm using Microsoft's own VB.NET FTP Example:
http://support.microsoft.com/default.aspx?scid=kb;en-us;832679
I can get the program to create directories, change directories, etc.,
but I can't...
|
by: Duffman |
last post by:
Hi,
I have what seems to be a common problem, but the solutions I've found don't
seem to work. I would like to use a web service to create a file at a UNC
location in a shared file. Currently...
|
by: =?Utf-8?B?QWRyaWFuTW9ycmlz?= |
last post by:
Hello!
I'm trying to copy a file from another computer on the network that I do not
have permission with my current logon details to access.
If I open the folder using the Windows file manager...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |