Jump to content

WScript not executing on WinServ2003


Deeto
 Share

Recommended Posts

I can create the WScript object - I am not having a permissions error. The problem is I'm trying to call a BAT file and what was working on WinXP no longer works on Win Server 2003.I'm running IIS with anonymous access but am using a specific local acct (not IUSR). This account has full access to the BAT, EXE and dir where it's located.Other WScript shell scripts are working, just not the call to this BAT. The BAT does work from command line, so I assume this is an acct issue but I can't figure out where. Any thoughts?Here's the code:

Set WshShell = CreateObject("WScript.Shell")Set WshExec = WshShell.Exec("C:\pdf2text.bat " & filename) 'where filename is the name of a PDF file in the FSpdftext = WshExec.StdOut.ReadAll'pdftext should now hold the text content inside the PDF filename

Here's the BAT code:

CD C:\Inetpub\wwwroot\HCForum\uploadfilespdftotext.exe -nopgbrk -eol dos %1 -'where %1 is the filename arg passed in, and dash (-) causes the result to be sent to StdOut

Thanks in advance for any advice!

Link to comment
Share on other sites

running the BAT directly works no problem. For some reason, I cannot call a BAT from WScript.Even if I change the content of the BAT to:MKDIR C:\HELLOit still doesn't run. No errors, and if I set the exec to a var the result is 0, which means that it executed successfully.I'm totally confused.

Link to comment
Share on other sites

I'd love to, but this EXE requires it run in the context of the appropriate directory. In other words, I cannot run it as:C:\Inetpub\wwwroot\HCForum\uploadfiles\pdftotext.exe -eol dos -nopgbrk C:\Inetpub\wwwroot\HCForum\uploadfiles\[filename] -The only syntax that works is:pdftotext.exe -eol dos -nopgbrk [filename] -which requires it be run from the correct directory.Are there permissions I can update in DCOMCONFIG to allow my IIS user acct to execute WSH bat files? I had to make these changes so the server would create WORD.APPLICATION and EXCEL.APPLICATION instances. I'm not sure what COM I would need to modify for WSH though.

Link to comment
Share on other sites

I'm not sure about that, I haven't had to do that before. Make sure the account has permission for the specific batch file and the specific exe. I'm not sure how Windows would classify a batch file or executable though, other than by those terms.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...