[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

How to launch a program from a VBS file (500pts)

Posted on 2008-01-29
7
Medium Priority
?
627 Views
Last Modified: 2012-05-05
I have a batch file that I can double click to start a certain program. I want to advertise this program via GPO but since the program continues to run after it launches the logon script window never disappears with a batch file. I think launching the program from a VBS file will fix this.

This seems like it should be a really simple script. Basically I want to launch the program from %logonserver%/netlogon with some switches. So for example program.exe /switch1 /switch2 /switch3

Im not too good with VB scripting so looking for someone to help me out here.

Thanks
0
Comment
Question by:Joseph Daly
  • 4
  • 2
7 Comments
 
LVL 3

Accepted Solution

by:
newborn1281 earned 2000 total points
ID: 20768624
Set objShell = CreateObject("WScript.Shell")
objShell.Exec "wuauclt.exe /resetauthorization /detectnow"

look at this example
0
 
LVL 35

Author Comment

by:Joseph Daly
ID: 20768654
Tried that when I run it on my local PC it works fine. When I set it to the logon script in the GPO it comes up with an error. Could not located the filepath where the executable is listed even though I know it is correct.
0
 
LVL 3

Expert Comment

by:newborn1281
ID: 20768794
how are you reaching executable ? \\servername\drive\folder\    ?
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
LVL 43

Expert Comment

by:Steve Knight
ID: 20768796
Try running it from the batch file as

START "" "\\server\share\yourprog.exe /arg1 /arg2"

then it will pass control to the other program then continue to the next entry in the batch file without stopping.

etc.
0
 
LVL 35

Author Comment

by:Joseph Daly
ID: 20768971
Tried that and I dont get any error messages but the program does not launch. No entries in the event viewer or anything.
0
 
LVL 3

Expert Comment

by:newborn1281
ID: 20769224
The only difference between the script above and the second script we showed you is that we changed objShell.Run to objShell.Exec. Yet, when you run this script, it appears to do nothing. You don't even see a window quickly flash open. Instead you see nothing at all. Would you believe us if we told you that ipconfig was actually being run? Well, don't take our word for it, instead, add a redirection symbol (>), followed by a text file name after the call to ipconfig. That will cause the output of the command to be put in the file. If you're not used to redirection, think of it this way: if we're telling you the truth and ipconfig is running, then it is creating it's standard text display. Unfortunately, we can't see it. The redirection will allow us to capture any output and force it into a file. This will help us verify whether or not the ipconfig command is being run. This next script rounds up our output for us.
0
 
LVL 3

Expert Comment

by:newborn1281
ID: 20769233
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Learn about cloud computing and its benefits for small business owners.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…

612 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