473,659 Members | 3,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.CreateOb ject("Wscript.S hell")
wshshell.run "c:\inetpub\www root\logasp\get dr.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\syst em32>set 1>c:\env.txt

C:\WINDOWS\syst em32>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 8839
=?Utf-8?B?RG91ZyBhdCB TQVU=?= wrote on 20 jun 2005 in
microsoft.publi c.inetserver.as p.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.CreateOb ject("Wscript.S hell")
wshshell.run "c:\inetpub\www root\logasp\get dr.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?RG91ZyBhdCB TQVU=?= wrote on 20 jun 2005 in
microsoft.publi c.inetserver.as p.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.CreateOb ject("Wscript.S hell")
wshshell.run "c:\inetpub\www root\logasp\get dr.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?RG91ZyBAIFN BVQ==?= wrote on 20 jun 2005 in
microsoft.publi c.inetserver.as p.general:
"Evertjan." wrote:
=?Utf-8?B?RG91ZyBhdCB TQVU=?= wrote on 20 jun 2005 in
microsoft.publi c.inetserver.as p.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.CreateOb ject("Wscript.S hell")
> wshshell.run "c:\inetpub\www root\logasp\get dr.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.FileS ystemObject. 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******** *************** ***********@mic rosoft.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.publi c.inetserver.as p.general:
"Doug at SAU" <Doug at SA*@discussions .microsoft.com> wrote in message
news:BC******** *************** ***********@mic rosoft.com...
I need to run a batch file on a remote machine from an ASP page.

[snip]

http://msdn.microsoft.com/library/en...onrunningscrip
tsremotelyrunni ngscriptoverthe refromhere.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.publi c.inetserver.as p.general:
"Doug at SAU" <Doug at SA*@discussions .microsoft.com> wrote in message
news:BC******** *************** ***********@mic rosoft.com...
I need to run a batch file on a remote machine from an ASP page.

[snip]

http://msdn.microsoft.com/library/en...onrunningscrip
tsremotelyrunni ngscriptoverthe refromhere.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("W SHController")
set oProcess = oController.Cre ateScript("c:\w sh5.6\beenhere. wsf",
"remmachine ")
oProcess.Execut e

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_{yourserve rname} 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.publi c.inetserver.as p.general:
"Doug at SAU" <Doug at SA*@discussions .microsoft.com> wrote in message
news:BC******** *************** ***********@mic rosoft.com...
I need to run a batch file on a remote machine from an ASP page.
[snip]

http://msdn.microsoft.com/library/en...onrunningscrip
tsremotelyrunni ngscriptoverthe refromhere.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("W SHController")
set oProcess = oController.Cre ateScript("c:\w sh5.6\beenhere. wsf",
"remmachine ")
oProcess.Execut e

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*****@discus sions.microsoft .com> wrote in message
news:20******** *************** ***********@mic rosoft.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
11021
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 a link in the HTML which launches the application (exe) with command line parameters. The Application and users are all within our Intranet - the application is accessible through a network dirve. I understand to enable this to happen, a user...
0
10141
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 files from the CD to the hard drive. Given that CD drives can have various names, I wanted to run the batch file using relative paths. The problem is, the DOS window that opens to run the batch file can leave the command prompt at any location . So...
29
5798
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 the transaction because I need a way to roll it back if any errors happen during the transaction. Unfortunately all tables affected in the long running transaction are completely locked and nobody else can access any of the affected tables while...
0
1338
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 if i manually trigger the batch, the results can be seen on the unix side. Running the batch script from an .aspx page however makes the process
13
5424
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 reason I should run the procedure via a batch file call as opposed to launching the command string directly?
2
1647
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 and there was no errors.. (is there a return type) we run a lot of sql jobs using batch files, so we want to create a user interface to run batch files
4
6426
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 thinking the following might help. I would appreciate if someone could comment on this idea and possibly suggest a better one: The environement variable in question is 'Path' in the HKCU registry folder's Environment key. I want to add some...
6
2120
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 them. Each data set that I generate, I put into an separate Access file which I eventually move to a server location that the particular client and I share access to.
0
2223
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 when ever some jobs will run on As400 to populate some files the program will be called to execute the batch files which will run the sql jobs to populate sql tables. This process working fine. But now we have installed SQL 2005 and trying to move ....
0
8428
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7359
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
bsmnconsultancy
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.