Solved

Wscript.Run doesn't work...

Posted on 2008-10-16
7
560 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
  • 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

746 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now