Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1072
  • Last Modified:

shell.run hangs

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
huji
Asked:
huji
  • 3
  • 2
1 Solution
 
wesbirdCommented:
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
 
wesbirdCommented:
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
 
hujiAuthor Commented:
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
 
hujiAuthor Commented:
Please pay attention to this question:
http:Q_21101268.html
Huji
0
 
wesbirdCommented:
PS for any late readers on this thread.. 5 usually means access denied.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now