wscript.shell error

F

ferg

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.createobject("wscript.shell")

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.ReadAll & "<br>"
Response.Write proc.stderr.readAll & "<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
 
R

Ray Costanzo [MVP]

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
 
F

ferg

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
 
R

Ray Costanzo [MVP]

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 "testaccount" 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
 
F

ferg

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
 
R

Ray Costanzo [MVP]

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
 
F

ferg

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
 

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

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top