Solved

Wscript.Run doesn't work...

Posted on 2008-10-16
7
569 Views
Last Modified: 2008-12-05
Hey all, i'm trying to run an executable but it doesn't seem to work. I tried the command in the cmd line and it works fine, but when i go to asp it doesn't seem to execute. I've set permissions in IIS (6) to executables and scripts and i gave IUSR full control of the asp file but still nothing. I also allowed IUSR and User full permission to the executable but still nothing. Any Ideas?
set wshell = server.createobject("wscript.shell") 
wshell.run "c:\iFtpSvc\iFtpAddU.exe -add user1 -h test.com -n ""John Doe"" -p 123 +chgpass +active +hostadm",0,true
set wshell = nothing

Open in new window

0
Comment
Question by:engineroom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 1

Expert Comment

by:justanoob
ID: 22729866
not sure, but maybe this

wshell.run "c:\iFtpSvc\iFtpAddU.exe -add user1 -h test.com -n \"John Doe\" -p 123 +chgpass +active +hostadm",0,true

or this

wshell.run "c:\iFtpSvc\iFtpAddU.exe -add user1 -h test.com -n 'John Doe' -p 123 +chgpass +active +hostadm",0,true

or this will do?

wshell.run "c:\iFtpSvc\iFtpAddU.exe -add user1 -h test.com -n "John Doe" -p 123 +chgpass +active +hostadm",0,true
0
 
LVL 3

Author Comment

by:engineroom
ID: 22730752
Thanx, but even if i totally omit the -n parameter, it still doesn't work... .but it does in the command line.
0
 
LVL 4

Expert Comment

by:rhodesb
ID: 22736262
I have had this exact same problem and it is very hard to troubleshoot.  The problem for me was that certain command line programs need access to temp directories or sometimes to other directories with dll's etc. and your IUSR and IWAM accounts may not have permission.  This is how I figured out what I needed:
On your server go to Control Panel -> Administrative Tools --> Event Viewer.
Clear out the logs (Save them first if you want) and try running the app through your asp script again.
Quickly look at the logs (sometimes they fill up fast), in particular the Security log and find errors that are caused by IUSR and/or IWAM trying to access parts of the file structure that they don't have permission to access.  It is not easy but will likely point you in the right direction.  It took me a long time to get command line PGP working in conjunction with SFTP in order to gather data from my database, encrypt it, then send via SFTP to one of my clients.
Good luck.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:justanoob
ID: 22738304
In that case, using Process Monitor might also help, as it will show you any failed file access attempt, among many other  things:

http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
0
 
LVL 3

Author Comment

by:engineroom
ID: 22766923
@rhodesb:

Thanx for your response. sorry to get back so slowly. Anyway, that didn't seem to work. I did exactly what you told me to do and there were no events after i ran the script. I did try running the script using a different executable and it did work, but i can't seem to get it to work for this...? don't know.

@justanoob:
Tried the modified command-line script and that also didn't  work.

Thanx guys... any other ideas?
0
 
LVL 3

Author Comment

by:engineroom
ID: 22868491
Does anyone have any other suggestions???? I'm experiencing this problem on a different machine and don't know why. It won't work..!
0
 
LVL 4

Accepted Solution

by:
rhodesb earned 500 total points
ID: 22869113
I still think the problem is likey a permissions problem where IUSR or IWAM don't have access to cmd.exe or wscript.exe or some specific dll or temp folder that are needed by iFTPAddU.exe. You can try using process monitor from SysInternals like justanoob suggested - I'm not very proficient at it so you'll have to ask someone else how to use it effectively - basically just clear the log, then run your asp page that is failing and look for access violations from IUSR and IWAM that happen shortly after, stop the capturing to prevent the list from getting too huge. Like I said above, it can be very tricky to find the permission that is causing the problem, once you do, just give the necessary permissions to fix the problem.

The only other thing that I can think of that would cause this problem (because you said that it works from the command line) is that iFTPAddU.exe is waiting for something, like a prompt.  I'm not familiar with this exact program so I don't know for sure but if you run the program and it fails for any reason and prompts to resolve the issue, you will never see the prompt and the app will just continue to wait.  This will be evident if after trying to run it many times, there are many instances of iFTPAddU.exe showing up in the task manager.  If this is the case, you have to figure out what the prompt is and how to suppress it so the app always finishes.  I also had this problem in setting up PGP because I didn't realize that the first time you encrypted for a new user, it would prompt even if it was set to suppress prompts.

Both these assume that you have some type of physical access to the administrator account on the server (either with a keyboard/monitor/mouse plugged directly into the server or through VNC or Remote Desktop or something similar).  If you don't have access to the server, then you need to talk to someone who does.

Sorry if this isn't really any more help.  Without having physical access to the server to do testing, likely I nor anybody else will be able to give you a definitive answer because we can't view the logs before and after to be able to find the problem for you.  Hopefully this just gets you in the right direction.

The reason it is happening on another server is still likely to be the same problem and until you find the permissions problem or deal with the prompt (whichever is actually causing the problem), it is not likely to ever work on a server that hasn't been set up to deal with this specific problem.  Sorry.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
INNER JOIN ? 8 52
CDO.Message not able to send attachement 5 40
ASP server side get value 15 46
Code Manager | Snippits 2 59
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question