473,379 Members | 1,220 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,379 software developers and data experts.

Spawning asynchronous server-side scripts

I need to start a lengthy file copy process going on our intranet
server from a .asp page. Since the .asp cannot wait for this to
complete - it might take anything up to half an hour - I've been
trying to use wshShell.Run to start a .wsf script running on the
server itself:

ignore = wshShell.Run("%comspec% /c ""cscript " & scriptpath & " " &
arguments & """", 1, false)

This starts the script OK, and will log what it is doing to a logfile
on the server so I can see what is going on. What I cannot do is
access a UNC share.

From what I can see, if my intranet runs as a pooled thread or as its
own thread, the script gets executed in the user context of the
IWAM_machine account. If I set the intranet to run as part of IIS, it
gets executed under the SYSTEM account. Neither of these have access
to shares in the larger domain, for obvious reasons.

So, is there a better way to start a process going without having to
wait for it to finish under an account that _does_ have rights to
these shares?

I can't really map lots of network drives as there are more potential
share locations than letters in the alphabet and the locations
regularly change. I can't map temporary network drives as multiple
copies of the script may be executing at once. So that's using the
wshNetwork object out the window :(

I really don't want to have to compile an .exe to do this as keeping
everything as script files makes it much easier to maintain and
update.
Jul 19 '05 #1
5 2652
"MikeT" <ne**@chthonic.f9.co.uk> wrote in message
news:af**************************@posting.google.c om...
I need to start a lengthy file copy process going on our intranet
server from a .asp page. Since the .asp cannot wait for this to
complete - it might take anything up to half an hour - I've been
trying to use wshShell.Run to start a .wsf script running on the
server itself:

ignore = wshShell.Run("%comspec% /c ""cscript " & scriptpath & " " &
arguments & """", 1, false)

This starts the script OK, and will log what it is doing to a logfile
on the server so I can see what is going on. What I cannot do is
access a UNC share.

From what I can see, if my intranet runs as a pooled thread or as its
own thread, the script gets executed in the user context of the
IWAM_machine account. If I set the intranet to run as part of IIS, it
gets executed under the SYSTEM account. Neither of these have access
to shares in the larger domain, for obvious reasons.

So, is there a better way to start a process going without having to
wait for it to finish under an account that _does_ have rights to
these shares?


Make your script a script component, register it in COM+, and set it to run
with an appropriate identity so it can access the network.

http://msdn.microsoft.com/library/de...l/lettitle.asp

--
Tom Kaminski IIS MVP
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
http://mvp.support.microsoft.com/
http://www.microsoft.com/windowsserv...y/centers/iis/

Jul 19 '05 #2
"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message news:<bq*********@kcweb01.netnews.att.com>...
"MikeT" <ne**@chthonic.f9.co.uk> wrote in message
news:af**************************@posting.google.c om...
I need to start a lengthy file copy process going on our intranet
server from a .asp page. Since the .asp cannot wait for this to
complete - it might take anything up to half an hour - I've been
trying to use wshShell.Run to start a .wsf script running on the
server itself:

ignore = wshShell.Run("%comspec% /c ""cscript " & scriptpath & " " &
arguments & """", 1, false)
[snip] So, is there a better way to start a process going without having to
wait for it to finish under an account that _does_ have rights to
these shares?


Make your script a script component, register it in COM+, and set it to run
with an appropriate identity so it can access the network.

http://msdn.microsoft.com/library/de...l/lettitle.asp


Thanks for that - not many changes are needed to make this a .wsc
component. Forgive me for being stupid, but how do I call this
component/write this component so that it runs the file transfer and
renaming asynchronously from the host .asp script?
Jul 19 '05 #3
"MikeT" <ne**@chthonic.f9.co.uk> wrote in message
news:af*************************@posting.google.co m...
"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message news:<bq*********@kcweb01.netnews.att.com>...
"MikeT" <ne**@chthonic.f9.co.uk> wrote in message
news:af**************************@posting.google.c om...
I need to start a lengthy file copy process going on our intranet
server from a .asp page. Since the .asp cannot wait for this to
complete - it might take anything up to half an hour - I've been
trying to use wshShell.Run to start a .wsf script running on the
server itself:

ignore = wshShell.Run("%comspec% /c ""cscript " & scriptpath & " " &
arguments & """", 1, false)
[snip] So, is there a better way to start a process going without having to
wait for it to finish under an account that _does_ have rights to
these shares?


Make your script a script component, register it in COM+, and set it to run with an appropriate identity so it can access the network.

http://msdn.microsoft.com/library/de...l/lettitle.asp
Thanks for that - not many changes are needed to make this a .wsc
component. Forgive me for being stupid, but how do I call this
component/write this component so that it runs the file transfer and
renaming asynchronously from the host .asp script?


Sorry, I missed the asynchronous bit. This might help:
http://www.aspfree.com/articles/644,1/articles.aspx
Jul 19 '05 #4
"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message
news:bq**********@kcweb01.netnews.att.com...
"MikeT" <ne**@chthonic.f9.co.uk> wrote in message
news:af*************************@posting.google.co m...
"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message news:<bq*********@kcweb01.netnews.att.com>...
"MikeT" <ne**@chthonic.f9.co.uk> wrote in message
news:af**************************@posting.google.c om...
> I need to start a lengthy file copy process going on our intranet
> server from a .asp page. Since the .asp cannot wait for this to
> complete - it might take anything up to half an hour - I've been
> trying to use wshShell.Run to start a .wsf script running on the
> server itself:
>
> ignore = wshShell.Run("%comspec% /c ""cscript " & scriptpath & " " &
> arguments & """", 1, false)
>

[snip]
> So, is there a better way to start a process going without having to
> wait for it to finish under an account that _does_ have rights to
> these shares?

Make your script a script component, register it in COM+, and set it
to run with an appropriate identity so it can access the network.

http://msdn.microsoft.com/library/de...l/lettitle.asp
Thanks for that - not many changes are needed to make this a .wsc
component. Forgive me for being stupid, but how do I call this
component/write this component so that it runs the file transfer and
renaming asynchronously from the host .asp script?


Sorry, I missed the asynchronous bit. This might help:
http://www.aspfree.com/articles/644,1/articles.aspx


Here's another thought - how about using wshShell.Run to call "Soon" (or
"AT" if you don't have the ResKit), which can "schedule" your script to run
in a few seconds?

--
Tom Kaminski IIS MVP
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
http://mvp.support.microsoft.com/
http://www.microsoft.com/windowsserv...y/centers/iis/

Jul 19 '05 #5
"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message news:<bq**********@kcweb01.netnews.att.com>...
"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message
news:bq**********@kcweb01.netnews.att.com...
"MikeT" <ne**@chthonic.f9.co.uk> wrote in message
news:af*************************@posting.google.co m...
"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message news:<bq*********@kcweb01.netnews.att.com>... > "MikeT" <ne**@chthonic.f9.co.uk> wrote in message
> news:af**************************@posting.google.c om...
> > I need to start a lengthy file copy process going on our intranet
> > server from a .asp page. Since the .asp cannot wait for this to
> > complete - it might take anything up to half an hour - I've been
> > trying to use wshShell.Run to start a .wsf script running on the
> > server itself:
> >
> > ignore = wshShell.Run("%comspec% /c ""cscript " & scriptpath & " " &
> > arguments & """", 1, false)
> > [snip] > > So, is there a better way to start a process going without having to
> > wait for it to finish under an account that _does_ have rights to
> > these shares?
>
> Make your script a script component, register it in COM+, and set it to
run > with an appropriate identity so it can access the network.
>
>

http://msdn.microsoft.com/library/de...l/lettitle.asp

Thanks for that - not many changes are needed to make this a .wsc
component. Forgive me for being stupid, but how do I call this
component/write this component so that it runs the file transfer and
renaming asynchronously from the host .asp script?


Sorry, I missed the asynchronous bit. This might help:
http://www.aspfree.com/articles/644,1/articles.aspx


Here's another thought - how about using wshShell.Run to call "Soon" (or
"AT" if you don't have the ResKit), which can "schedule" your script to run
in a few seconds?


I'll take a look at that too, but won't that just run the script in
the same user-contexts as I experienced with wshShell.Run above?

The aspfree link looks interesting - seems a much better fit to my
problem at first glance anyway. Thanks for your help.
Jul 19 '05 #6

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

Similar topics

2
by: Chris | last post by:
I have a stand-alone program that I want to convert into a client-server type approach so that instead of running several instances of the same program I just spawn new child processes. In theory...
9
by: Michael Lindsey | last post by:
I need to write a server app to send images to client GUIs that are outside of the server's domain. The client will have the file system path to the image but can not access the file system. I am...
7
by: Colin | last post by:
I'm writing a little console socket server but I'm having some difficulty. Can I ask your advice - where is the best place to get some help on that topic? It would be nice if some people who knew...
3
by: Thomas Nielsen | last post by:
Hi, I need to make a web page that wait for 3 asynchronous processes to finish. So I am considering these options 1) Poll the status of the processes from the web page using the "REFRESH"...
4
by: taskswap | last post by:
I have a legacy application written in C that I'm trying to convert to C#. It processes a very large amount of data from many clients (actually, upstream servers - this is a mux) simultaneously. ...
4
by: Macca | last post by:
I am writing an application that uses asynchronous sockets to get data over ethernet from embedded devices, up to 30 concurrent devices.(These devices are written in C). My application...
7
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason...
0
by: Bishoy George | last post by:
Hi, I have a asp.net 2.0 web application. I want to implement the asynchronous model through http handler in web.config ...
4
by: Engineerik | last post by:
I am trying to create a socket server which will listen for connections from multiple clients and call subroutines in a Fortran DLL and pass the results back to the client. The asynchronous socket...
7
by: jtbjurstrom | last post by:
Bear with me because we are new to WCF and have been going through documentation and samples trying to absorb as much as possible in a short amount of time. Any suggestions would be much...
1
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.