473,320 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

running a batch file

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 "c:\inetpub\wwwroot\logasp\getdr.bat > c:\tstlog.txt"
%>

the batch file is as follows:
set >c:\env.txt
dir c:\*.*
On my local machine, it runs fine, generating the env.txt and tstlog.txt
files. When I put it on another machine, the directory and environment
commands don't run. All I get is:
C:\WINDOWS\system32>set 1>c:\env.txt

C:\WINDOWS\system32>dir c:\*.*

for a response. I've tried setting the authentication to BASIC as suggested
by a Microsoft SME at TechED but to no avail. Why does it not work?

In the end, I need to be able to have the ASP page call a batch file to
change ACLS on files on a remote machine.

Any help would be appreciated.


Jul 22 '05 #1
9 8823
=?Utf-8?B?RG91ZyBhdCBTQVU=?= wrote on 20 jun 2005 in
microsoft.public.inetserver.asp.general:
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 "c:\inetpub\wwwroot\logasp\getdr.bat > c:\tstlog.txt"
%>


ASP runs on the server, not on a remote,
if you mean by remote the machine the browser runs on.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #2
for clarification:

I am wanting to run a script from an asp page on a server against another
machine.

When I ran everything on my workstation, it worked fine. When I moved the
code to another machine and logged in, it didn't work.

The sample ASP page doesn't return anything, only a blank page. I have to
go to the server to see if the batch file ran on that machine.

"Evertjan." wrote:
=?Utf-8?B?RG91ZyBhdCBTQVU=?= wrote on 20 jun 2005 in
microsoft.public.inetserver.asp.general:
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 "c:\inetpub\wwwroot\logasp\getdr.bat > c:\tstlog.txt"
%>


ASP runs on the server, not on a remote,
if you mean by remote the machine the browser runs on.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #3
=?Utf-8?B?RG91ZyBAIFNBVQ==?= wrote on 20 jun 2005 in
microsoft.public.inetserver.asp.general:
"Evertjan." wrote:
=?Utf-8?B?RG91ZyBhdCBTQVU=?= wrote on 20 jun 2005 in
microsoft.public.inetserver.asp.general:
> 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 "c:\inetpub\wwwroot\logasp\getdr.bat > c:\tstlog.txt"
> %>
>
ASP runs on the server, not on a remote,
if you mean by remote the machine the browser runs on.


[please do not toppost on usenet]
for clarification:

I am wanting to run a script from an asp page on a server against
another machine.
So you want to run the asp file on a distant server and sun the shell
there?
When I ran everything on my workstation, it worked fine. When I moved
the code to another machine and logged in, it didn't work.

The sample ASP page doesn't return anything, only a blank page. I
have to go to the server to see if the batch file ran on that machine.


I think that must be a rights issue.

The process that runs ASP has very limited rights by default.

However if a blank file is made the batch must have run and you could
inspect the tstlog.txt file from remote by running another asp file with
Scripting.FileSystemObject. If you cannot reach c:\tstlog.txt because of
insufficient rights, the shell command would probably have the same
problem. [except for a possible read-only right]
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #4
"Doug at SAU" <Doug at SA*@discussions.microsoft.com> wrote in message
news:BC**********************************@microsof t.com...
I need to run a batch file on a remote machine from an ASP page.

[snip]

http://msdn.microsoft.com/library/en...refromhere.asp
Jul 22 '05 #5
Chris Hohmann wrote on 21 jun 2005 in
microsoft.public.inetserver.asp.general:
"Doug at SAU" <Doug at SA*@discussions.microsoft.com> wrote in message
news:BC**********************************@microsof t.com...
I need to run a batch file on a remote machine from an ASP page.

[snip]

http://msdn.microsoft.com/library/en...onrunningscrip
tsremotelyrunningscriptovertherefromhere.asp


that is not from an ASP page!
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #6
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn*******************@194.109.133.242...
Chris Hohmann wrote on 21 jun 2005 in
microsoft.public.inetserver.asp.general:
"Doug at SAU" <Doug at SA*@discussions.microsoft.com> wrote in message
news:BC**********************************@microsof t.com...
I need to run a batch file on a remote machine from an ASP page.

[snip]

http://msdn.microsoft.com/library/en...onrunningscrip
tsremotelyrunningscriptovertherefromhere.asp


that is not from an ASP page!


No need to shout. Doug already demonstrated a knowledge of being able to
reference WSH from ASP. As such, I gave him credit for being able to copy
and paste the following lines from the example into his ASP page:

set oController = CreateObject("WSHController")
set oProcess = oController.CreateScript("c:\wsh5.6\beenhere.wsf",
"remmachine")
oProcess.Execute

Note to Doug:
You'll need to enable remote scripting on the target server. Take note of
the link at the bottom of the article about "Setting Up Remote WSH":
http://msdn.microsoft.com/library/en...fremotewsh.asp

Jul 22 '05 #7
Couple of things
1.Use UNC path.Theres nothing called mapped drive on network. SO if th
remote machine is abcdefg and drive is c then use
\\abcdefg\c$ ( assuming C$ is the share name)

2.When you run your ASP pages, it runs under IUSR_{yourservername} user.Make
sure thsi guy has permission on the remote server

"Chris Hohmann" wrote:
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn*******************@194.109.133.242...
Chris Hohmann wrote on 21 jun 2005 in
microsoft.public.inetserver.asp.general:
"Doug at SAU" <Doug at SA*@discussions.microsoft.com> wrote in message
news:BC**********************************@microsof t.com...
I need to run a batch file on a remote machine from an ASP page.
[snip]

http://msdn.microsoft.com/library/en...onrunningscrip
tsremotelyrunningscriptovertherefromhere.asp


that is not from an ASP page!


No need to shout. Doug already demonstrated a knowledge of being able to
reference WSH from ASP. As such, I gave him credit for being able to copy
and paste the following lines from the example into his ASP page:

set oController = CreateObject("WSHController")
set oProcess = oController.CreateScript("c:\wsh5.6\beenhere.wsf",
"remmachine")
oProcess.Execute

Note to Doug:
You'll need to enable remote scripting on the target server. Take note of
the link at the bottom of the article about "Setting Up Remote WSH":
http://msdn.microsoft.com/library/en...fremotewsh.asp

Jul 22 '05 #8

Thanks folks for the discussion. I really appreciate it.

What I found interesting was that during initial testing, although the batch
file DID run on the remote server, it returned no data, either the for the
environment or for the directory.

I will try the remote scripting settings that were suggested.

The concern is that it is running as IUSER_..... I had hoped that using
authentication, that it would take the credentials of the logged in user.

I'm toying with the idea of using integrated authentication to get access to
the ASP pages, then using a log in screen and capturing the login/password as
session variables, then having the code create the batch files to execute
commands in a RUNAS environment.

Feedback on this idea would be much appreciated.
THANKS AGAIN!!
Jul 22 '05 #9
"Doug @ SAU" <Do*****@discussions.microsoft.com> wrote in message
news:20**********************************@microsof t.com...
The concern is that it is running as IUSER_..... I had hoped that using
authentication, that it would take the credentials of the logged in user.


I believe this is the "double-hop" authentication issue. Basically, when
using challenge/response NTLM authentication the password never gets
transmitted, only a hash of it does. As such, the server is unable to act as
a delegate to access resources located on other machines. Here's a white
paper that does a much better job of describing the issue and also outlines
a number of methods for resolving it.

http://www.microsoft.com/technet/pro.../tkerbdel.mspx
Jul 22 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Brad Smith | last post by:
I have a unique requirement to run an executable file from withing a HTML document. The HTML is actually embedded in an email sent as a notification to a user of our application. I need to include...
0
by: SkySea | last post by:
Hi! Any help on this would be appreciated... In an HTML document that lists instructions on installing some software, there's a point where a DOS batch file needs to be run in order to copy...
29
by: pb648174 | last post by:
I have a very long transaction that runs on the same database that other users need to use for existing data. I don't care if they see data from the transaction before it is done and am only using...
0
by: joeted | last post by:
Hi, I am using system.diagnostic.process with the intention of running a program to communicate with a unix box: The program is "PuTTY", running from a batch script. I know it works because...
13
by: MLH | last post by:
I have a batch file named GetConf.bat. It contains a line like this: ipconfig /all >c:\MyAppDir\IPdata.txt I believe I could run the line with something like ShellWait by Terry Kreft. Any...
2
by: Stephen | last post by:
Hi all, I want to create an app that runs a batch file which inturn runs applications. question: if I start the batch file from app1, how can app1 know that the batch file ran successfully...
4
by: Shiraz | last post by:
Hi I'm using Visual Studio Installer to make my installer, and have not as yet figured out a straightforward way to use it to set environmental variables. Amongst the various things I tried, I'm...
6
by: Mat N | last post by:
Hello access friends, (Originally posted on access.formsprogramming which I think was the wrong place) I'm precalculating a bunch of data for my clients as per a profile I have for each of...
0
by: sunrt | last post by:
We have an As400 system that has program which executes batch files which resides on the SQL server 7.0 computer . Those batch files run SQL server jobs using isql. The whole idea about this is...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.