Starting exe's on server using wshell

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:
Set WShShell = Server.CreateObject("WScript.Shell")
RetCode = WShShell.Run ("c:\WINNT\NOTEPAD.EXE",1,false)
WShShell.AppActivate RetCode
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,
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.
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.

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

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


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.

 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 ;(

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
Here's a simple tutorial,

More Tutorials at :

If you want more tutorials just type 'ACTIVE X Tutorial VB' in

Happy programming,
Ayhan Elatik
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.
EE Cleanup Volunteer
All Courses

From novice to tech pro — start learning today.