Error 800a0046 when trying to run a program

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Patrice FRITSCH

    Error 800a0046 when trying to run a program

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

    Dim oWSH
    set oWSH= Server.CreateOb ject("WScript.S hell")
    call oWSH.Run("cmd.e xe /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.


  • Ray Costanzo [MVP]

    #2
    Re: Error 800a0046 when trying to run a program

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

    Ray at work

    "Patrice FRITSCH" <patrice.fritsc h@NOSPAM.com> wrote in message
    news:e2pyCu6nEH A.3988@tk2msftn gp13.phx.gbl...[color=blue]
    > I'm trying to run a batch file from an asp page using WScript.Shell
    > object.
    >
    > Dim oWSH
    > set oWSH= Server.CreateOb ject("WScript.S hell")
    > call oWSH.Run("cmd.e xe /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.
    >
    >[/color]


    Comment

    • Patrice FRITSCH

      #3
      Re: Error 800a0046 when trying to run a program

      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.



      "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> a écrit dans
      le message de news:%233xZuh%2 3nEHA.708@TK2MS FTNGP09.phx.gbl ...[color=blue]
      > Do you have any antivirus software running on the server that may prevent
      > the creation of WScript.Shell, perhaps?
      >
      > Ray at work
      >
      > "Patrice FRITSCH" <patrice.fritsc h@NOSPAM.com> wrote in message
      > news:e2pyCu6nEH A.3988@tk2msftn gp13.phx.gbl...[color=green]
      > > I'm trying to run a batch file from an asp page using WScript.Shell
      > > object.
      > >
      > > Dim oWSH
      > > set oWSH= Server.CreateOb ject("WScript.S hell")
      > > call oWSH.Run("cmd.e xe /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[/color][/color]
      asp[color=blue][color=green]
      > > page.
      > > Works fine on a Windows 2000 Server but not on an 2003 server.
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Patrice FRITSCH

        #4
        Re: Error 800a0046 when trying to run a program

        Hello Ray,

        Running oWSH.Run("cmd.e xe /c dir > toto.txt", 0, true) works fine
        Running oWSH.Run("cmd.e xe /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 ?


        [color=blue]
        > Do you have any antivirus software running on the server that may prevent
        > the creation of WScript.Shell, perhaps?
        >
        > Ray at work
        >
        > "Patrice FRITSCH" <patrice.fritsc h@NOSPAM.com> wrote in message
        > news:e2pyCu6nEH A.3988@tk2msftn gp13.phx.gbl...[color=green]
        > > I'm trying to run a batch file from an asp page using WScript.Shell
        > > object.
        > >
        > > Dim oWSH
        > > set oWSH= Server.CreateOb ject("WScript.S hell")
        > > call oWSH.Run("cmd.e xe /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[/color][/color]
        asp[color=blue][color=green]
        > > page.
        > > Works fine on a Windows 2000 Server but not on an 2003 server.
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Ray Costanzo [MVP]

          #5
          Re: Error 800a0046 when trying to run a program

          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" <patrice.fritsc h@NOSPAM.com> wrote in message
          news:%23$Pa6xKo EHA.2024@TK2MSF TNGP09.phx.gbl. ..[color=blue]
          > Hello Ray,
          >
          > Running oWSH.Run("cmd.e xe /c dir > toto.txt", 0, true) works fine
          > Running oWSH.Run("cmd.e xe /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 ?
          >
          >
          >[color=green]
          >> Do you have any antivirus software running on the server that may prevent
          >> the creation of WScript.Shell, perhaps?
          >>
          >> Ray at work
          >>
          >> "Patrice FRITSCH" <patrice.fritsc h@NOSPAM.com> wrote in message
          >> news:e2pyCu6nEH A.3988@tk2msftn gp13.phx.gbl...[color=darkred]
          >> > I'm trying to run a batch file from an asp page using WScript.Shell
          >> > object.
          >> >
          >> > Dim oWSH
          >> > set oWSH= Server.CreateOb ject("WScript.S hell")
          >> > call oWSH.Run("cmd.e xe /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[/color][/color]
          > asp[color=green][color=darkred]
          >> > page.
          >> > Works fine on a Windows 2000 Server but not on an 2003 server.
          >> >
          >> >[/color]
          >>
          >>[/color]
          >
          >[/color]


          Comment

          • Patrice FRITSCH

            #6
            Re: Error 800a0046 when trying to run a program

            Ray,

            Here is my code

            set WSH= Server.CreateOb ject("WScript.S hell")
            ' szCmd = "c:\fop-0.20.5\fop.bat -xml " & Server.MapPath( "./SH005303.xml")
            & " -xsl " & Server.MapPath( "./InstallReport.x sl") & " -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 [MVP]" <my first name at lane 34 dot commercial> a écrit dans
            le message de news:eZMIBELoEH A.592@TK2MSFTNG P11.phx.gbl...[color=blue]
            > Can you post all of your code, or at least all that is relevant here?[/color]
            See,[color=blue]
            > 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[/color]
            can[color=blue]
            > "see." If the batch file is trying to do something unauthorized, this[/color]
            error[color=blue]
            > would be returned to the stdout from the command prompt, which would not[/color]
            be[color=blue]
            > 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[/color]
            would[color=blue]
            > 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" <patrice.fritsc h@NOSPAM.com> wrote in message
            > news:%23$Pa6xKo EHA.2024@TK2MSF TNGP09.phx.gbl. ..[color=green]
            > > Hello Ray,
            > >
            > > Running oWSH.Run("cmd.e xe /c dir > toto.txt", 0, true) works fine
            > > Running oWSH.Run("cmd.e xe /c toto.bat > toto.txt", 0, true) does'nt[/color][/color]
            work[color=blue][color=green]
            > > (toto.bat contains only one line : DIR !!!)
            > > Is there something else that can prevent the running of a batch file ?
            > >
            > >
            > >[color=darkred]
            > >> Do you have any antivirus software running on the server that may[/color][/color][/color]
            prevent[color=blue][color=green][color=darkred]
            > >> the creation of WScript.Shell, perhaps?
            > >>
            > >> Ray at work
            > >>
            > >> "Patrice FRITSCH" <patrice.fritsc h@NOSPAM.com> wrote in message
            > >> news:e2pyCu6nEH A.3988@tk2msftn gp13.phx.gbl...
            > >> > I'm trying to run a batch file from an asp page using WScript.Shell
            > >> > object.
            > >> >
            > >> > Dim oWSH
            > >> > set oWSH= Server.CreateOb ject("WScript.S hell")
            > >> > call oWSH.Run("cmd.e xe /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[/color]
            > > asp[color=darkred]
            > >> > page.
            > >> > Works fine on a Windows 2000 Server but not on an 2003 server.
            > >> >
            > >> >
            > >>
            > >>[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            Working...