Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 09:54 AM
MikeT
Guest
 
Posts: n/a
Default 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.
  #2  
Old July 19th, 2005, 09:54 AM
Tom Kaminski [MVP]
Guest
 
Posts: n/a
Default Re: Spawning asynchronous server-side scripts

"MikeT" <news@chthonic.f9.co.uk> wrote in message
news:af4a582c.0312021103.15fbb0eb@posting.google.c om...[color=blue]
> 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?[/color]

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/



  #3  
Old July 19th, 2005, 09:59 AM
MikeT
Guest
 
Posts: n/a
Default Re: Spawning asynchronous server-side scripts

"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message news:<bqioof$q3c9@kcweb01.netnews.att.com>...[color=blue]
> "MikeT" <news@chthonic.f9.co.uk> wrote in message
> news:af4a582c.0312021103.15fbb0eb@posting.google.c om...[color=green]
> > 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)
> >[/color][/color]
[snip][color=blue][color=green]
> > 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?[/color]
>
> 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[/color]

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?
  #4  
Old July 19th, 2005, 09:59 AM
Tom Kaminski [MVP]
Guest
 
Posts: n/a
Default Re: Spawning asynchronous server-side scripts

"MikeT" <news@chthonic.f9.co.uk> wrote in message
news:af4a582c.0312050453.9ca7cd0@posting.google.co m...[color=blue]
> "Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message[/color]
news:<bqioof$q3c9@kcweb01.netnews.att.com>...[color=blue][color=green]
> > "MikeT" <news@chthonic.f9.co.uk> wrote in message
> > news:af4a582c.0312021103.15fbb0eb@posting.google.c om...[color=darkred]
> > > 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)
> > >[/color][/color]
> [snip][color=green][color=darkred]
> > > 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?[/color]
> >
> > Make your script a script component, register it in COM+, and set it to[/color][/color]
run[color=blue][color=green]
> > with an appropriate identity so it can access the network.
> >
> >[/color][/color]
http://msdn.microsoft.com/library/de...l/lettitle.asp[color=blue]
>
> 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?[/color]

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


  #5  
Old July 19th, 2005, 09:59 AM
Tom Kaminski [MVP]
Guest
 
Posts: n/a
Default Re: Spawning asynchronous server-side scripts

"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message
news:bqq0i4$q3d27@kcweb01.netnews.att.com...[color=blue]
> "MikeT" <news@chthonic.f9.co.uk> wrote in message
> news:af4a582c.0312050453.9ca7cd0@posting.google.co m...[color=green]
> > "Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message[/color]
> news:<bqioof$q3c9@kcweb01.netnews.att.com>...[color=green][color=darkred]
> > > "MikeT" <news@chthonic.f9.co.uk> wrote in message
> > > news:af4a582c.0312021103.15fbb0eb@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)
> > > >[/color]
> > [snip][color=darkred]
> > > > 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[/color][/color][/color]
to[color=blue]
> run[color=green][color=darkred]
> > > with an appropriate identity so it can access the network.
> > >
> > >[/color][/color]
>[/color]
http://msdn.microsoft.com/library/de...l/lettitle.asp[color=blue][color=green]
> >
> > 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?[/color]
>
> Sorry, I missed the asynchronous bit. This might help:
> http://www.aspfree.com/articles/644,1/articles.aspx[/color]

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/



  #6  
Old July 19th, 2005, 10:01 AM
MikeT
Guest
 
Posts: n/a
Default Re: Spawning asynchronous server-side scripts

"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message news:<bqq0r2$q3d28@kcweb01.netnews.att.com>...[color=blue]
> "Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message
> news:bqq0i4$q3d27@kcweb01.netnews.att.com...[color=green]
> > "MikeT" <news@chthonic.f9.co.uk> wrote in message
> > news:af4a582c.0312050453.9ca7cd0@posting.google.co m...[color=darkred]
> > > "Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message[/color][/color]
> news:<bqioof$q3c9@kcweb01.netnews.att.com>...[color=green][color=darkred]
> > > > "MikeT" <news@chthonic.f9.co.uk> wrote in message
> > > > news:af4a582c.0312021103.15fbb0eb@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)
> > > > >[/color][/color]
> [snip][color=green][color=darkred]
> > > > > 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[/color][/color]
> to
> run[color=green][color=darkred]
> > > > with an appropriate identity so it can access the network.
> > > >
> > > >[/color]
> >[/color]
> http://msdn.microsoft.com/library/de...l/lettitle.asp[color=green][color=darkred]
> > >
> > > 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?[/color]
> >
> > Sorry, I missed the asynchronous bit. This might help:
> > http://www.aspfree.com/articles/644,1/articles.aspx[/color]
>
> 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?[/color]

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.
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles