Click to See Complete Forum and Search --> : WScript.Shell seems not working in Windows 2003 Server


ryanlcs
04-15-2008, 12:45 AM
I got this script hosted on Win XP Pro SP2, it will invoke an exe file and it works just fine. Then I transfer the file to host in Win 2003 Server, the program will invoke the exe, I saw from task manager, but it performs nothing. I had check on the parameter passing into the exe and finds no error.

Calling exe
Set WShell = Server.Createobject("WScript.Shell")
WShell.Run ("""" & Session.Contents("HTMLGuardianPath") & """ f, " & strSource1 & ", " & strDestination1 & ", , 1")
Set WShell = Nothing

I also tried out on bat file, and I get the same outcome, it works fine on Win XP, but failed when hosted under Win 2003 Server.

Calling bat
Set WShell = Server.Createobject("WScript.Shell")
WShell.Run ("""D:\Intra\Encrypt File.bat"" """ & strSource1 & """ """ & strDestination1 & """")
Set WShell = Nothing

I was just wondering is there a limitation for Wscript.Shell to run on Win 2003 Server. Coz I dont get any sort of error message.

I did tried to run the Bat file from windows, (without going thru my ASP program), and it works.

Hope anyone could provide me a guideline.

Thanks.

russell
04-15-2008, 12:50 PM
get rid of Server.

just CreateObject()

Server. is a reference to an ASP object, which doesn't exist outside of ASP

ryanlcs
04-16-2008, 12:34 AM
Tried that out too, but dont solve the problem. Will try to search ard for other solutions.

russell
04-16-2008, 12:48 AM
why all those quotes?

tried like this?

Dim command
command = "D:\Intra\Encrypt File.bat " & strSource1 & " " & strDestination1
WShell.Run (command)

tried just a simple echo to make sure Wscript isnt disabled on the server?

by the way to answer your question, no, wscript runs on win2k3 server fine -- unless administrator has disabled it

ryanlcs
04-16-2008, 01:02 AM
I need 2 quotes for each paramater or variable because there is a space in between. The below path, there is a space between Encrypt and File, without 2 quotes before and after, the command fails.

D:\Intra\Encrypt File.bat

Previously I got Permission Denied on batch file, but got it sort out.

How to try an echo?

Thanks.

ryanlcs
04-16-2008, 01:08 AM
But if the Wscript is disabled on Win 2K3, then I should received some kind of errors right?

Actually, now there is no errors being thrown out.

ryanlcs
04-16-2008, 05:58 AM
Finally, got it sorted out. It is the Application Pool setting on the IIS, change this to MSShareAppPool and it works. No idea what's is the value for, so long it works, i am happy.

ryanlcs
04-17-2008, 08:09 PM
It should be MSSharePointAppPool

jonpfl
07-10-2008, 08:46 AM
It should be MSSharePointAppPool

I am getting a "Permission denied" for anything I try to do with cscript. I went into IIS and saw where this option was but it wasnt available in my dropdown list.

Any ideas?

Thx
jonpfl