WScript.CreateObject
(1)
WScript.Shell
(1)
VBScript
(1)
ResultCode
(1)
WshShell
(1)
MyApp
(1)
Vbs
(1)
Executeable
(1)

Easy one? Have vbs logon script run local executeable

Asked By Jake
08-Feb-10 05:05 AM
Hi,

I use a vbs logon script at my domain controllers.

I need to run an application from the client computers' C: drive when
they log on...

The logon script code below tries to run MyApp for the domain
controller's C: disk, I need it to be run from the clients' C: disk.

Set WshShell = WScript.CreateObject("WScript.Shell")
ResultCode = WshShell.Run("C:\Program Files\MyApp.exe", 1, true)

How do I do that...?

regards jake

You missed out on some double quotes.

Pegasus [MVP] replied to Jake
08-Feb-10 06:25 AM
You missed out on some double quotes. Modify your code as below, then run it
from a Command Prompt. What you see is exactly what the script interpreter
passes to the Command Processor. If you typed the command as you see it on
the screen, would it work? With those embedded spaces?

Set WshShell = WScript.CreateObject("WScript.Shell")
ResultCode = WshShell.Run("C:\Program Files\MyApp.exe", 1, true)
wscript.echo "C:\Program Files\MyApp.exe"

Aside from the required code correction that Pegasus pointed out.

LikeToCode replied to Jake
08-Feb-10 10:23 AM
Aside from the required code correction that Pegasus pointed out. Your post
is lacking some more detail. How are you applying the logon script, Group
Policy or on the Users' Profile in AD? Is the script residing in the
running the myapp.exe on the DC? Remove the path to myapp.exe on the DC and
see if that produces any errors. I believe this post should be in the Servers
group instead.

Like yours, our logon script is written in VBScript, and it is run from

Al Dunbar replied to Jake
08-Feb-10 11:22 PM
Like yours, our logon script is written in VBScript, and it is run from a
domain controller. When our script runs, it runs on the PC we are logging
into, and, in that context, "C:" is the hard drive on the workstation, not
on the domain controllers.

If you wanted to run an executable actually located on a DC, you would have
to calculate a path to it relative to the path to the script.

The script you supplied actually does do (or tries to do) what you say you
want it to do. Does it work when you run it interactively from a
workstation? If not, perhaps you have the path wrong - are you sure it is not


/Al
Post Question To EggHeadCafe