WScript Object - Example needed

[I accidentally posted this question under "web development" but I don't know how to delete it - needless to say I got no answer there and wasted points]

I know how to write the codes but it doesn't work for me.  I mean thing was done after running the asp file.

Here is the ASP code:
'=========================
<%
dim WshShell
set wshshell=server.CreateObject("WScript.shell")
WshShell.Run("c:\test.bat")
Set WshShell=Nothing
%>
'==========================
Here is the content of test.bat:

echo this is a test>test.log

After running the above asp code I expect to see a file test.log in my c:\ directory on the server.  But I don't see it.  Can someone give me an example of a working code so I can test to see this shell command object actually works ?

Thanks in advance.  If it works I'll increase the points of course.
LVL 3
keystrokesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ejulsonCommented:
The Wscript.Shell object is not available to IIS.This object is only available to the Windows Scripting Host.

If you want to write to a file, you should consider using a FileSystemObject in your ASP page.
0
ejulsonCommented:
The Wscript.Shell object is not available to IIS.This object is only available to the Windows Scripting Host.

If you want to write to a file, you should consider using a FileSystemObject in your ASP page.
0
keystrokesAuthor Commented:
Do you have any links, references?
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

keystrokesAuthor Commented:
I found a link from microsoft that this object works. http://support.microsoft.com/default.aspx?scid=kb;en-us;301309#5
0
keystrokesAuthor Commented:
This crap only works on some servers.  I have heard some report from some people the exact same code worked.  Anyone knows why?
0
mikkolsoftCommented:
keystrokes:

That code runs provided that you have Visual Studio 6.0 (or up I assume).

"This method requires that you install Visual Basic 6.0. In this method, you create a Visual Basic ActiveX DLL project in order to create a COM component that you can use in your ASP page. This COM component contains a method that uses the LogEvent method of the Application object to write the passed text to the Event Log."

Whereas FSO is always available.
Look at the example here: http://asp-hispeed-logging.pstruh.cz/help/ScptUtl/pa24.htm

Mikkol
0
ejulsonCommented:
It is the process permissions that IIS 5 is running under.  I'm looking for a doc to explain this, but if you change the "Application Protection" on the website to "Low", your problem should be solved.  (With noted security issues!)
0
ejulsonCommented:
Application Protection

Select whether applications are run in the same process as Web services (low), in an isolated pooled process in which other applications are also run (medium), or in an isolated process separate from other processes (high).

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iisref/htm/developingdebuggingandsecuringiisapplications.asp


0
mgfranzCommented:
"The Wscript.Shell object is not available to IIS.This object is only available to the Windows Scripting Host."???

What is this?

Your code is fine, the problem has to do with permissions that the file and the directory you are trying to run the WScript from, the IUSER_ has to have Read/Write/Exe perms on the directory or the file.
0
mgfranzCommented:
More details here; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsoriWindowsScriptHost.asp

And:
* Run the Internet Services Manager for IIS.
* Right Click on the Website in question and select properties
* Under the 'Directory' Tab, Towards the bottom, change Execute Permissions from Scripts Only to Scripts and Executables.

0
mgfranzCommented:
You don't need Visual Basic either, WSH is installed with XP and W2K, but if you are not sure it's installed you can get it here; http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/001/728/msdncompositedoc.xml
0
mgfranzCommented:
And one other thing, if you are running Norton Anti-Virus, the original wshost.ocx is over-wrote by Norton.  You will have to unregister the .ocx, then re-register the original .ocx

This is an awful lot of help for 20 points...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
keystrokesAuthor Commented:
mikkolsoft:

Where did you get the quote from?  Please send me the link.  This sounds odd: I actually tried to LogEvent method and it worked.  But the Run function didn't work.  If it was a VB component problem, wouldn't it affect the LogEvent method also?
0
keystrokesAuthor Commented:
mqfranz:
You know I am very generous with the points.  I give 20 points to the answer that sounds technically correct regardless of the issue, eventhough it doesn't solve my problem.  If it does, the points will increased accordingly.
0
mgfranzCommented:
Did you try my suggestion of unregistering the .ocx and .dll, then reinstalling WSH?

There are a lot of good suggestions here, (some better than others), have you had a chance to try them out?

If you ask CS to delete the Q at WD I'm sure they will accomidate you.
0
mikkolsoftCommented:
keystrokes:

haha I found that from the MS link you provided! Just a bit under it which says "Requirements That Are Specific to This Method" :P Good luck.

Mikkol
0
keystrokesAuthor Commented:
mikkolsoft:

I don't doubt that this component is required for specific IIS settings, otherwise I'd have made it work already, with mqfranz's so many suggestions.
0
keystrokesAuthor Commented:
Guess what guys?

The component was working all this time but I just didn't know it because it took me for a detour.  I did a file search and I found the product of the asp using wsh.  It's actually under two directries, one is the "winnt\system32" and the other one is under "documents and settings\user1\recent", instead of the root directory where the batch file is located.  

As for running any other files such as exe files, I guess I'll have to change the setting of the server to see if it works.  For the time being, this is fine for my purpose.  

Hope this will help your future development!  Hey you guys got to give me the points instead.  

Actually, I'll give mqfranz the points for his hard work, and thanks everyone.
0
mikkolsoftCommented:
Glad to know it works. Yes mqfranz deserves the pts for the research and stuff :)

Mikkol
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.