Error 800a0046 when trying to run a program

P

Patrice FRITSCH

I'm trying to run a batch file from an asp page using WScript.Shell object.

Dim oWSH
set oWSH= Server.CreateObject("WScript.Shell")
call oWSH.Run("cmd.exe /c " & szCmd , 0, true)

szCmd contains the program to execute (fop.bat with several parameters).

But I'm getting the following error message :

Microsoft VBScript runtime error '800a0046'
Permission denied


The IUSR_xxxx has full control access to the directory containing the asp
page.
Works fine on a Windows 2000 Server but not on an 2003 server.
 
R

Ray Costanzo [MVP]

Do you have any antivirus software running on the server that may prevent
the creation of WScript.Shell, perhaps?

Ray at work
 
P

Patrice FRITSCH

Yes I have McAfee VirusScan Entreprise installed.
Works fine with my Win2KServer having also Viruscan installed.

I will have a try with VirusScan disabled.
Thanks.
 
P

Patrice FRITSCH

Hello Ray,

Running oWSH.Run("cmd.exe /c dir > toto.txt", 0, true) works fine
Running oWSH.Run("cmd.exe /c toto.bat > toto.txt", 0, true) does'nt work
(toto.bat contains only one line : DIR !!!)
Is there something else that can prevent the running of a batch file ?
 
R

Ray Costanzo [MVP]

Can you post all of your code, or at least all that is relevant here? See,
you shouldn't be getting access denied's based on what the batch file is
doing. If you (iusr) have access to cmd.exe, that's about as far as ASP can
"see." If the batch file is trying to do something unauthorized, this error
would be returned to the stdout from the command prompt, which would not be
bounced back into an ASP error. Like, if you ran "cmd.exe /c net start
[some service]" and your IUSR account isn't authorized to do this, you would
not see this error. Now, if your IUSR didn't have NTFS permissions to
cmd.exe, for example, then you'd see a permission denied error.

Are you positive that your iusr account is authorized to access cmd.exe?

Ray at work
 
P

Patrice FRITSCH

Ray,

Here is my code

set WSH= Server.CreateObject("WScript.Shell")
' szCmd = "c:\fop-0.20.5\fop.bat -xml " & Server.MapPath("./SH005303.xml")
& " -xsl " & Server.MapPath("./InstallReport.xsl") & " -pdf " &
Server.MapPath("./SH005303.pdf") & " > " & Server.MapPath("./log_fop.txt")
' szCmd = "%COMSPEC% /c " & Server.MapPath("./toto.bat") & " > " &
Server.MapPath("./log_fop.txt")
szCmd = "%COMSPEC% /c dir > " & Server.MapPath("./log_fop.txt")
x=WSH.Run(szCmd, , true)
response.Write("Run error = " & x)
set WSH = nothing

I don't have the 800a0046 error anymore :)
When I'm running "cmd.exe /c dir > file.txt" everything works fine and
WSH.run return 0
But when I'm running cmd.exe /c toto.bat > file.txt I, WSH.run return 1
(toto.bat contains the dir command).

Ray Costanzo said:
Can you post all of your code, or at least all that is relevant here? See,
you shouldn't be getting access denied's based on what the batch file is
doing. If you (iusr) have access to cmd.exe, that's about as far as ASP can
"see." If the batch file is trying to do something unauthorized, this error
would be returned to the stdout from the command prompt, which would not be
bounced back into an ASP error. Like, if you ran "cmd.exe /c net start
[some service]" and your IUSR account isn't authorized to do this, you would
not see this error. Now, if your IUSR didn't have NTFS permissions to
cmd.exe, for example, then you'd see a permission denied error.

Are you positive that your iusr account is authorized to access cmd.exe?

Ray at work

Patrice FRITSCH said:
Hello Ray,

Running oWSH.Run("cmd.exe /c dir > toto.txt", 0, true) works fine
Running oWSH.Run("cmd.exe /c toto.bat > toto.txt", 0, true) does'nt work
(toto.bat contains only one line : DIR !!!)
Is there something else that can prevent the running of a batch file ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top