Solved

shell.run hangs

Posted on 2004-08-20
5
1,047 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
ID: 11850864
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
ID: 11850911
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
ID: 11852069
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
ID: 11865374
Please pay attention to this question:
http:Q_21101268.html
Huji
0
 
LVL 7

Expert Comment

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

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
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/…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

813 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

12 Experts available now in Live!

Get 1:1 Help Now