Jump to content

WScript not executing on WinServ2003


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 post
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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...