Starting exe's on server using wshell

Hello,
I'm trying to start an instance of Notepad on my server using wshell. Notepad will start, but it remains a background process - I can't bring it to the foreground.
This is what I've been using:
<code>
Set WShShell = Server.CreateObject("WScript.Shell")
RetCode = WShShell.Run ("c:\WINNT\NOTEPAD.EXE",1,false)
WShShell.AppActivate RetCode
</code>
It's seems like such a simple thing to do, but it's driving me nuts!
I'm using IIS.5 - is it likely to be a server setting that's stopping it or am I missing something really obvious?
Thanks in advance,
Ross
theboyrossAsked:
Who is Participating?
 
webwomanConnect With a Mentor Commented:
I really, really wouldn't set it up that way. There are MUCH much better ways of locking down machines. Set a profile for them that doesn't have access to anything but what you want.

It will work regardless of their level of expertise, and they not only won't be able to run unauthorized software, they won't be able to install anything either. Nor will they be able to DELETE any software or make any system changes.

I work in a college, where we have tons of machines available for students and staff. Most users do NOT have the ability to install anything, change any system settings, or run any software that hasn't been set up for them. And the student machines don't even save anything -- all changes get trashed on reboot. You can certainly do most of this with Win2K -- that's what most of our machines run.

So there ARE better, way more secure ways.
0
 
aelatikCommented:
It's not possible, ASP doesn't have a GUI. It will do what you want but wont show it. Use Active X Controls instead, they run client side.

0
 
webwomanCommented:
What do you EXPECT it to do? It's running on the SERVER -- you're never going to see it.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
DRY_GINCommented:

are you sure vbNormalFocus is 1 ?

Maybe you need to put delay and call AppActivate after few milliseconds so the notepad will be ready to become active.

also:
Try
 WshShell.SendKeys "{%TAB}"
I don't think it will work, but it be a  Alt+TAB so you will switch you app's and notepad will become active app
...

Also you can try wshshell.Exec instead of .run

..
Also AppActivate can have two parameters, second parameter is wait and i have no idea what does it mean.

..
and a Last one
You can run "cmd.exe notepad.exe" this also should work..


I can't test anything here , so i'm only guessing ;(


0
 
theboyrossAuthor Commented:
Thanks everyone.
webwoman - I can see that this looks like a rather strange thing to do. The reason is rather unconventional but I'll try and explain it. We give out laptops to our employees - these employees are largely computer illiterate and we don't want them using them for any other business, but we do want them to run one or two exe's (I used notepad in this example). I want to set up a webpage on each machine that gives the user choices of which exe's to run. ASP is used as it is fairly simple technology to set up and maintain and IIS is included with our Win2K builds - we can also lock down access to anything else on the machine. Therefore, each machine acts as server and the exe's need to open up server side.
DRY GIN - Thanks for the suggestions. I've had a crack at each of them and I'm still getting the same output unfortunately.
aelatik - I think ActiveX may be the way forward - Could you suggest anywhere I could find more information?
thanks again
Ross
0
 
aelatikCommented:
Here's a simple tutorial,

http://www.geocities.com/SiliconValley/Horizon/3950/ActiveX.htm

More Tutorials at : http://www.tutorgig.com/showurls.jsp?group=5454&index=0

If you want more tutorials just type 'ACTIVE X Tutorial VB' in www.google.com

Happy programming,
Ayhan Elatik
0
 
GaryCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept Answer by webwoman

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
GaryC123
EE Cleanup Volunteer
0
All Courses

From novice to tech pro — start learning today.