Solved

shell.run hangs

Posted on 2004-08-20
5
1,023 Views
Last Modified: 2010-08-05
Hi
I am trying to run regsvr32.exe from an ASP code using WScript Shell object with such code:

<%
Dim wshell, intReturn
set wshell = server.createobject("wscript.shell")
intReturn = wshell.run("%comspec% /c regsvr32 /u ""C:\Documents and Settings\Hojjat\Desktop\shell.wsc"" ", 0, True)
Response.Write( intReturn )
set wshell = nothing
%>

Looking to my task manager, I see that IWAM user on my computer openes cmd and regsvr32 programs, but it failes to unregister the component.
When I run this sample code to open Notepad:

<%
Dim wshell, intReturn
set wshell = server.createobject("wscript.shell")
intReturn = wshell.run("%comspec% /c notepad.exe", 0, True)
Response.Write( intReturn )
set wshell = nothing
%>

It not only does not open notepad, but also hangs running the code. I don't know how to finish the procedure or close notepad.exe myself.

Why does the code hang on running regsvr32, notepad.exe etc? Notice that IUSR user has the permission to read and execute regsvr32 and notepad.exe on my machine.

Huji
0
Comment
Question by:huji
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:wesbird
Comment Utility
if would be a good idea to include the /s option to regsvr32 to prevent it from opening a mesage box on the desktop of the process - which is probably invisible unless you're logged on interactively as IUSR_...
0
 
LVL 7

Accepted Solution

by:
wesbird earned 500 total points
Comment Utility
I meant to say "window station" of the process.  See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/window_stations.asp.

Your code is not hanging, merely being displayed on a window station that you cannot see because it is not interactive.
0
 
LVL 14

Author Comment

by:huji
Comment Utility
Well, hang problem is solved by now, but the code is not acting indeed. It returns 5 to me, which I don't know what it means, but I know it is different from normal 0 or 1 values I have recieved from a Run command.
Do you know why it is not acting? And by the way, can I register components this way? For example upload a DLL to my root directory, then install it running regsvr32 through ASP?
Huji
0
 
LVL 14

Author Comment

by:huji
Comment Utility
Please pay attention to this question:
http:Q_21101268.html
Huji
0
 
LVL 7

Expert Comment

by:wesbird
Comment Utility
PS for any late readers on this thread.. 5 usually means access denied.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now