wscript.shell error

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

    wscript.shell error

    People; i'm from argentina so , sorry, but my english isn´t good...

    Now, the question is; I'm trying to run a *.bat program on an ASP page,
    with the wsh script, but i can´t do it... because i obtain an error code (5
    access denied)
    I let you the code that i´m using, so you can help me

    Dim wshell, proc set wshell = server.createob ject("wscript.s hell")

    prg="%comspec% /c net stop dns"
    set proc = wshell.exec(prg )

    Do While proc.Status < 1

    Loop
    Response.Write prg & "<br>"
    Response.Write proc.StdOut.Rea dAll & "<br>"
    Response.Write proc.stderr.rea dAll & "<br>"
    set wshell = nothing

    .....

    I tried besides, the "run" methon instead of "exec", but the result is the
    same...
    so ... help!!!
    I have gave permissons (total control) to IWAM and IUSR users on the page
    folder, and on cmd.exe program and net.exe program; but there isn´t case, it
    doesn´t work...

    Thanks for your suggestions; and sorry about my english... If you don´t
    understand my , let me knot that, and i try to explain better...

    Ferg



  • Ray Costanzo [MVP]

    #2
    Re: wscript.shell error

    In addition to needing NTFS permissions to the executables, the user account
    executing the command needs permissions to run the command, itself. Someone
    who is a GUEST, such as IUSR doesn't have the rights in Windows to start and
    stop services. You could add your iusr account to the admin group (not real
    advised) or run that page with a different anonymous account that is an
    admin (a bit safer).

    Ray at work

    "ferg" <fgiletta@solso ft(punto)com(pu nto)ar> wrote in message
    news:%23u5qeaEd GHA.3348@TK2MSF TNGP03.phx.gbl. ..[color=blue]
    > People; i'm from argentina so , sorry, but my english isn´t good...
    >
    > Now, the question is; I'm trying to run a *.bat program on an ASP page,
    > with the wsh script, but i can´t do it... because i obtain an error code
    > (5 access denied)
    > I let you the code that i´m using, so you can help me
    >
    > Dim wshell, proc set wshell = server.createob ject("wscript.s hell")
    >
    > prg="%comspec% /c net stop dns"
    > set proc = wshell.exec(prg )
    >
    > Do While proc.Status < 1
    >
    > Loop
    > Response.Write prg & "<br>"
    > Response.Write proc.StdOut.Rea dAll & "<br>"
    > Response.Write proc.stderr.rea dAll & "<br>"
    > set wshell = nothing
    >
    > ....
    >
    > I tried besides, the "run" methon instead of "exec", but the result is the
    > same...
    > so ... help!!!
    > I have gave permissons (total control) to IWAM and IUSR users on the page
    > folder, and on cmd.exe program and net.exe program; but there isn´t case,
    > it doesn´t work...
    >
    > Thanks for your suggestions; and sorry about my english... If you don´t
    > understand my , let me knot that, and i try to explain better...
    >
    > Ferg
    >
    >[/color]


    Comment

    • ferg

      #3
      Re: wscript.shell error

      Thank you Ray, but what do you mean when you say "...or run that page with a
      different anonymous account that is an
      admin (a bit safer)." . How can i run the page with a different anonymous
      account ? ...

      Thanks again
      Ferg

      "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> escribió en
      el mensaje news:uzJcgmEdGH A.1324@TK2MSFTN GP04.phx.gbl...[color=blue]
      > In addition to needing NTFS permissions to the executables, the user
      > account executing the command needs permissions to run the command,
      > itself. Someone who is a GUEST, such as IUSR doesn't have the rights in
      > Windows to start and stop services. You could add your iusr account to
      > the admin group (not real advised) or run that page with a different
      > anonymous account that is an admin (a bit safer).
      >
      > Ray at work
      >
      > "ferg" <fgiletta@solso ft(punto)com(pu nto)ar> wrote in message
      > news:%23u5qeaEd GHA.3348@TK2MSF TNGP03.phx.gbl. ..[color=green]
      >> People; i'm from argentina so , sorry, but my english isn´t good...
      >>
      >> Now, the question is; I'm trying to run a *.bat program on an ASP page,
      >> with the wsh script, but i can´t do it... because i obtain an error code
      >> (5 access denied)
      >> I let you the code that i´m using, so you can help me
      >>
      >> Dim wshell, proc set wshell = server.createob ject("wscript.s hell")
      >>
      >> prg="%comspec% /c net stop dns"
      >> set proc = wshell.exec(prg )
      >>
      >> Do While proc.Status < 1
      >>
      >> Loop
      >> Response.Write prg & "<br>"
      >> Response.Write proc.StdOut.Rea dAll & "<br>"
      >> Response.Write proc.stderr.rea dAll & "<br>"
      >> set wshell = nothing
      >>
      >> ....
      >>
      >> I tried besides, the "run" methon instead of "exec", but the result is
      >> the same...
      >> so ... help!!!
      >> I have gave permissons (total control) to IWAM and IUSR users on the page
      >> folder, and on cmd.exe program and net.exe program; but there isn´t case,
      >> it doesn´t work...
      >>
      >> Thanks for your suggestions; and sorry about my english... If you don´t
      >> understand my , let me knot that, and i try to explain better...
      >>
      >> Ferg
      >>
      >>[/color]
      >
      >
      >[/color]



      Comment

      • Ray Costanzo [MVP]

        #4
        Re: wscript.shell error

        It's a configuration in IIS. You can set this at a site, application, or
        file level. To do it at the file level for example:

        - Create a new local account on the machine called "testaccoun t" or
        something along those lines.

        - Add this account to the local administrators group on the machine

        - in IIS, browse to the file with the code in question. Right click ---
        Properties

        - Go to the File Security tab

        - Under "Anonymous access and authentication control" click the Edit...
        button

        - Make sure that Anonymous access is checked

        - Change the account from IUSR_... to this new test account and enter the
        password.

        Ray at work



        "ferg" <fgiletta@solso ft(punto)com(pu nto)ar> wrote in message
        news:%23hq6%23R GdGHA.1324@TK2M SFTNGP04.phx.gb l...[color=blue]
        > Thank you Ray, but what do you mean when you say "...or run that page with
        > a different anonymous account that is an
        > admin (a bit safer)." . How can i run the page with a different anonymous
        > account ? ...
        >
        > Thanks again
        > Ferg
        >
        > "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> escribió en
        > el mensaje news:uzJcgmEdGH A.1324@TK2MSFTN GP04.phx.gbl...[color=green]
        >> In addition to needing NTFS permissions to the executables, the user
        >> account executing the command needs permissions to run the command,
        >> itself. Someone who is a GUEST, such as IUSR doesn't have the rights in
        >> Windows to start and stop services. You could add your iusr account to
        >> the admin group (not real advised) or run that page with a different
        >> anonymous account that is an admin (a bit safer).
        >>
        >> Ray at work
        >>
        >> "ferg" <fgiletta@solso ft(punto)com(pu nto)ar> wrote in message
        >> news:%23u5qeaEd GHA.3348@TK2MSF TNGP03.phx.gbl. ..[color=darkred]
        >>> People; i'm from argentina so , sorry, but my english isn´t good...
        >>>
        >>> Now, the question is; I'm trying to run a *.bat program on an ASP page,
        >>> with the wsh script, but i can´t do it... because i obtain an error code
        >>> (5 access denied)
        >>> I let you the code that i´m using, so you can help me
        >>>
        >>> Dim wshell, proc set wshell = server.createob ject("wscript.s hell")
        >>>
        >>> prg="%comspec% /c net stop dns"
        >>> set proc = wshell.exec(prg )
        >>>
        >>> Do While proc.Status < 1
        >>>
        >>> Loop
        >>> Response.Write prg & "<br>"
        >>> Response.Write proc.StdOut.Rea dAll & "<br>"
        >>> Response.Write proc.stderr.rea dAll & "<br>"
        >>> set wshell = nothing
        >>>
        >>> ....
        >>>
        >>> I tried besides, the "run" methon instead of "exec", but the result is
        >>> the same...
        >>> so ... help!!!
        >>> I have gave permissons (total control) to IWAM and IUSR users on the
        >>> page folder, and on cmd.exe program and net.exe program; but there isn´t
        >>> case, it doesn´t work...
        >>>
        >>> Thanks for your suggestions; and sorry about my english... If you don´t
        >>> understand my , let me knot that, and i try to explain better...
        >>>
        >>> Ferg
        >>>
        >>>[/color]
        >>
        >>
        >>[/color]
        >
        >
        >[/color]


        Comment

        • ferg

          #5
          Re: wscript.shell error

          Thank you Ray; but it doesn´t work
          it is still returning error 5, access denied...
          I did everything you tell me, but it doesn´t work...
          I don´t know what is going on...

          Do you have any idea?...
          Thank you again...
          Ferg from Argentina

          "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> escribió en
          el mensaje news:uGi9inGdGH A.1320@TK2MSFTN GP04.phx.gbl...[color=blue]
          > It's a configuration in IIS. You can set this at a site, application, or
          > file level. To do it at the file level for example:
          >
          > - Create a new local account on the machine called "testaccoun t" or
          > something along those lines.
          >
          > - Add this account to the local administrators group on the machine
          >
          > - in IIS, browse to the file with the code in question. Right click ---
          > Properties
          >
          > - Go to the File Security tab
          >
          > - Under "Anonymous access and authentication control" click the Edit...
          > button
          >
          > - Make sure that Anonymous access is checked
          >
          > - Change the account from IUSR_... to this new test account and enter the
          > password.
          >
          > Ray at work
          >
          >
          >
          > "ferg" <fgiletta@solso ft(punto)com(pu nto)ar> wrote in message
          > news:%23hq6%23R GdGHA.1324@TK2M SFTNGP04.phx.gb l...[color=green]
          >> Thank you Ray, but what do you mean when you say "...or run that page
          >> with a different anonymous account that is an
          >> admin (a bit safer)." . How can i run the page with a different anonymous
          >> account ? ...
          >>
          >> Thanks again
          >> Ferg
          >>
          >> "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> escribió
          >> en el mensaje news:uzJcgmEdGH A.1324@TK2MSFTN GP04.phx.gbl...[color=darkred]
          >>> In addition to needing NTFS permissions to the executables, the user
          >>> account executing the command needs permissions to run the command,
          >>> itself. Someone who is a GUEST, such as IUSR doesn't have the rights in
          >>> Windows to start and stop services. You could add your iusr account to
          >>> the admin group (not real advised) or run that page with a different
          >>> anonymous account that is an admin (a bit safer).
          >>>
          >>> Ray at work
          >>>
          >>> "ferg" <fgiletta@solso ft(punto)com(pu nto)ar> wrote in message
          >>> news:%23u5qeaEd GHA.3348@TK2MSF TNGP03.phx.gbl. ..
          >>>> People; i'm from argentina so , sorry, but my english isn´t good...
          >>>>
          >>>> Now, the question is; I'm trying to run a *.bat program on an ASP
          >>>> page, with the wsh script, but i can´t do it... because i obtain an
          >>>> error code (5 access denied)
          >>>> I let you the code that i´m using, so you can help me
          >>>>
          >>>> Dim wshell, proc set wshell = server.createob ject("wscript.s hell")
          >>>>
          >>>> prg="%comspec% /c net stop dns"
          >>>> set proc = wshell.exec(prg )
          >>>>
          >>>> Do While proc.Status < 1
          >>>>
          >>>> Loop
          >>>> Response.Write prg & "<br>"
          >>>> Response.Write proc.StdOut.Rea dAll & "<br>"
          >>>> Response.Write proc.stderr.rea dAll & "<br>"
          >>>> set wshell = nothing
          >>>>
          >>>> ....
          >>>>
          >>>> I tried besides, the "run" methon instead of "exec", but the result is
          >>>> the same...
          >>>> so ... help!!!
          >>>> I have gave permissons (total control) to IWAM and IUSR users on the
          >>>> page folder, and on cmd.exe program and net.exe program; but there
          >>>> isn´t case, it doesn´t work...
          >>>>
          >>>> Thanks for your suggestions; and sorry about my english... If you don´t
          >>>> understand my , let me knot that, and i try to explain better...
          >>>>
          >>>> Ferg
          >>>>
          >>>>
          >>>
          >>>
          >>>[/color]
          >>
          >>
          >>[/color]
          >
          >
          >[/color]



          Comment

          • Ray Costanzo [MVP]

            #6
            Re: wscript.shell error

            I'm experiencing that also. It must have to do with the act of starting and
            stopping services, as when I change the command to:

            prg="%comspec% /c net send %computername% test"

            That executes fine.

            I played around with various local security policies on my machine (XP Pro
            SP2) and was unable to get it to execute.

            Ray at work


            "ferg" <fgiletta@solso ft(punto)com(pu nto)ar> wrote in message
            news:u9YPKCHdGH A.4900@TK2MSFTN GP02.phx.gbl...[color=blue]
            > Thank you Ray; but it doesn´t work
            > it is still returning error 5, access denied...
            > I did everything you tell me, but it doesn´t work...
            > I don´t know what is going on...
            >
            > Do you have any idea?...
            > Thank you again...
            > Ferg from Argentina
            >
            > "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> escribió en
            > el mensaje news:uGi9inGdGH A.1320@TK2MSFTN GP04.phx.gbl...[color=green]
            >> It's a configuration in IIS. You can set this at a site, application, or
            >> file level. To do it at the file level for example:
            >>
            >> - Create a new local account on the machine called "testaccoun t" or
            >> something along those lines.
            >>
            >> - Add this account to the local administrators group on the machine
            >>
            >> - in IIS, browse to the file with the code in question. Right click ---
            >> Properties
            >>
            >> - Go to the File Security tab
            >>
            >> - Under "Anonymous access and authentication control" click the Edit...
            >> button
            >>
            >> - Make sure that Anonymous access is checked
            >>
            >> - Change the account from IUSR_... to this new test account and enter the
            >> password.
            >>
            >> Ray at work
            >>
            >>
            >>
            >> "ferg" <fgiletta@solso ft(punto)com(pu nto)ar> wrote in message
            >> news:%23hq6%23R GdGHA.1324@TK2M SFTNGP04.phx.gb l...[color=darkred]
            >>> Thank you Ray, but what do you mean when you say "...or run that page
            >>> with a different anonymous account that is an
            >>> admin (a bit safer)." . How can i run the page with a different
            >>> anonymous account ? ...
            >>>
            >>> Thanks again
            >>> Ferg
            >>>
            >>> "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> escribió
            >>> en el mensaje news:uzJcgmEdGH A.1324@TK2MSFTN GP04.phx.gbl...
            >>>> In addition to needing NTFS permissions to the executables, the user
            >>>> account executing the command needs permissions to run the command,
            >>>> itself. Someone who is a GUEST, such as IUSR doesn't have the rights
            >>>> in Windows to start and stop services. You could add your iusr account
            >>>> to the admin group (not real advised) or run that page with a different
            >>>> anonymous account that is an admin (a bit safer).
            >>>>
            >>>> Ray at work
            >>>>
            >>>> "ferg" <fgiletta@solso ft(punto)com(pu nto)ar> wrote in message
            >>>> news:%23u5qeaEd GHA.3348@TK2MSF TNGP03.phx.gbl. ..
            >>>>> People; i'm from argentina so , sorry, but my english isn´t good...
            >>>>>
            >>>>> Now, the question is; I'm trying to run a *.bat program on an ASP
            >>>>> page, with the wsh script, but i can´t do it... because i obtain an
            >>>>> error code (5 access denied)
            >>>>> I let you the code that i´m using, so you can help me
            >>>>>
            >>>>> Dim wshell, proc set wshell = server.createob ject("wscript.s hell")
            >>>>>
            >>>>> prg="%comspec% /c net stop dns"
            >>>>> set proc = wshell.exec(prg )
            >>>>>
            >>>>> Do While proc.Status < 1
            >>>>>
            >>>>> Loop
            >>>>> Response.Write prg & "<br>"
            >>>>> Response.Write proc.StdOut.Rea dAll & "<br>"
            >>>>> Response.Write proc.stderr.rea dAll & "<br>"
            >>>>> set wshell = nothing
            >>>>>
            >>>>> ....
            >>>>>
            >>>>> I tried besides, the "run" methon instead of "exec", but the result is
            >>>>> the same...
            >>>>> so ... help!!!
            >>>>> I have gave permissons (total control) to IWAM and IUSR users on the
            >>>>> page folder, and on cmd.exe program and net.exe program; but there
            >>>>> isn´t case, it doesn´t work...
            >>>>>
            >>>>> Thanks for your suggestions; and sorry about my english... If you
            >>>>> don´t understand my , let me knot that, and i try to explain better...
            >>>>>
            >>>>> Ferg
            >>>>>
            >>>>>
            >>>>
            >>>>
            >>>>
            >>>
            >>>
            >>>[/color]
            >>
            >>
            >>[/color]
            >
            >
            >[/color]


            Comment

            • ferg

              #7
              Re: wscript.shell error

              so, it doesn´t work for you?

              I don´t know what i´m going to do about this...

              I've try to set permissons to "cmd.exe" and "net.exe" to the user that I
              have created, but ... it doesn´t work at all...

              So... i'm tired; here in Argentina it's 19.00 o'clock, so i will try another
              things tomorrow

              thanks a lot. (... do you understand me ? or I write like an Indian...
              jajaja)
              Ferg

              "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> escribió en
              el mensaje news:el2eqbHdGH A.4128@TK2MSFTN GP05.phx.gbl...[color=blue]
              > I'm experiencing that also. It must have to do with the act of starting
              > and stopping services, as when I change the command to:
              >
              > prg="%comspec% /c net send %computername% test"
              >
              > That executes fine.
              >
              > I played around with various local security policies on my machine (XP Pro
              > SP2) and was unable to get it to execute.
              >
              > Ray at work
              >
              >
              > "ferg" <fgiletta@solso ft(punto)com(pu nto)ar> wrote in message
              > news:u9YPKCHdGH A.4900@TK2MSFTN GP02.phx.gbl...[color=green]
              >> Thank you Ray; but it doesn´t work
              >> it is still returning error 5, access denied...
              >> I did everything you tell me, but it doesn´t work...
              >> I don´t know what is going on...
              >>
              >> Do you have any idea?...
              >> Thank you again...
              >> Ferg from Argentina
              >>
              >> "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> escribió
              >> en el mensaje news:uGi9inGdGH A.1320@TK2MSFTN GP04.phx.gbl...[color=darkred]
              >>> It's a configuration in IIS. You can set this at a site, application,
              >>> or file level. To do it at the file level for example:
              >>>
              >>> - Create a new local account on the machine called "testaccoun t" or
              >>> something along those lines.
              >>>
              >>> - Add this account to the local administrators group on the machine
              >>>
              >>> - in IIS, browse to the file with the code in question. Right click ---
              >>> Properties
              >>>
              >>> - Go to the File Security tab
              >>>
              >>> - Under "Anonymous access and authentication control" click the Edit...
              >>> button
              >>>
              >>> - Make sure that Anonymous access is checked
              >>>
              >>> - Change the account from IUSR_... to this new test account and enter
              >>> the password.
              >>>
              >>> Ray at work
              >>>
              >>>
              >>>
              >>> "ferg" <fgiletta@solso ft(punto)com(pu nto)ar> wrote in message
              >>> news:%23hq6%23R GdGHA.1324@TK2M SFTNGP04.phx.gb l...
              >>>> Thank you Ray, but what do you mean when you say "...or run that page
              >>>> with a different anonymous account that is an
              >>>> admin (a bit safer)." . How can i run the page with a different
              >>>> anonymous account ? ...
              >>>>
              >>>> Thanks again
              >>>> Ferg
              >>>>
              >>>> "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> escribió
              >>>> en el mensaje news:uzJcgmEdGH A.1324@TK2MSFTN GP04.phx.gbl...
              >>>>> In addition to needing NTFS permissions to the executables, the user
              >>>>> account executing the command needs permissions to run the command,
              >>>>> itself. Someone who is a GUEST, such as IUSR doesn't have the rights
              >>>>> in Windows to start and stop services. You could add your iusr
              >>>>> account to the admin group (not real advised) or run that page with a
              >>>>> different anonymous account that is an admin (a bit safer).
              >>>>>
              >>>>> Ray at work
              >>>>>
              >>>>> "ferg" <fgiletta@solso ft(punto)com(pu nto)ar> wrote in message
              >>>>> news:%23u5qeaEd GHA.3348@TK2MSF TNGP03.phx.gbl. ..
              >>>>>> People; i'm from argentina so , sorry, but my english isn´t good...
              >>>>>>
              >>>>>> Now, the question is; I'm trying to run a *.bat program on an ASP
              >>>>>> page, with the wsh script, but i can´t do it... because i obtain an
              >>>>>> error code (5 access denied)
              >>>>>> I let you the code that i´m using, so you can help me
              >>>>>>
              >>>>>> Dim wshell, proc set wshell = server.createob ject("wscript.s hell")
              >>>>>>
              >>>>>> prg="%comspec% /c net stop dns"
              >>>>>> set proc = wshell.exec(prg )
              >>>>>>
              >>>>>> Do While proc.Status < 1
              >>>>>>
              >>>>>> Loop
              >>>>>> Response.Write prg & "<br>"
              >>>>>> Response.Write proc.StdOut.Rea dAll & "<br>"
              >>>>>> Response.Write proc.stderr.rea dAll & "<br>"
              >>>>>> set wshell = nothing
              >>>>>>
              >>>>>> ....
              >>>>>>
              >>>>>> I tried besides, the "run" methon instead of "exec", but the result
              >>>>>> is the same...
              >>>>>> so ... help!!!
              >>>>>> I have gave permissons (total control) to IWAM and IUSR users on the
              >>>>>> page folder, and on cmd.exe program and net.exe program; but there
              >>>>>> isn´t case, it doesn´t work...
              >>>>>>
              >>>>>> Thanks for your suggestions; and sorry about my english... If you
              >>>>>> don´t understand my , let me knot that, and i try to explain
              >>>>>> better...
              >>>>>>
              >>>>>> Ferg
              >>>>>>
              >>>>>>
              >>>>>
              >>>>>
              >>>>>
              >>>>
              >>>>
              >>>>
              >>>
              >>>
              >>>[/color]
              >>
              >>
              >>[/color]
              >
              >
              >[/color]



              Comment

              Working...