Starting programs, batch files on computer from a different computer

Posted on 2004-11-11
Last Modified: 2010-04-14
I have a batch file and a Visual Basic program that, using the Windows Task Scheduler, run around 3am each weekend on a computer in a secured room at work.  If either of these programs fail, for whatever reason, both of them have to be restarted; first the batch file, and when it's finished, then the Visual Basic program. These programs must run on the computer, not anywhere else.  Due to corporate red-tape, I cannot remote in from home to this computer to restart these programs.  However, I can remote onto a server using Terminal Services Client, and the computer and server are linked through the network.  

How can I restart these two programs so that they run on the computer?  Thank you for your help!
Question by:psmithphil
    LVL 86

    Assisted Solution

    'PsExec' ( can do that:


    usage: psexec [\\computer[,computer[,..] | @file ][-u user [-p psswd]][-n s][-s|-e][-i][-c [-f|-v]][-d][-w directory][-<priority>][-a n,n,...] cmd [arguments]

    Direct PsExec to run the application on the computer or computers specified. If you omit the computer name PsExec runs the application on the local system and if you enter a computer name of "\\*" PsExec runs the applications on all computers in the current domain.

    Directs PsExec to run the command on each computer listed in the text file specified.

    Separate processors on which the application can run with commas where 1 is the lowest numbered CPU. For example, to run the application on CPU 2 and CPU 4, enter: "-a 2,4"

    Copy the specified program to the remote system for execution. If you omit this option then the application must be in the system's path on the remote system.

    Don't wait for application to terminate. Only use this option for non-interactive applications.
    Loads the specified account's profile.

    Copy the specified program to the remote system even if the file already exists on the remote system.

    Run the program so that it interacts with the desktop on the remote system.

    Specifies timeout in seconds connecting to remote computers.

    Specifies optional password for user name. If you omit this you will be prompted to enter a hidden password.

    Run remote process in the System account .

    Specifies optional user name for login to remote computer.

    Copy the specified file only if it has a higher version number or is newer on than the one on the remote system.

    Set the working directory of the process (relative to the remote computer).

    Specifies -low, -belownormal, -abovenormal, -high or -realtime to run the process at a different priority.

    Name of the program to execute.

    Arguments to pass (note that file paths must be absolute paths on the target system)

    (see also
    LVL 16

    Accepted Solution

    If neither of the programs require interaction with the console, you can run them from the command line using TELNET

    Start the telnet service and logon with the TELNET.EXE client from you workstation and you have a command prompt that is actually "at" the remote machine.

    You will need port 23 open inbound to the server to allow telnet to work.



    Author Comment

    Well, both ways work to get the batch file going.  For some reason the Visual Basic program, when started via telnet, runs for a little over a minute and then stops.   If I run the program from the Task Scheduler, it runs completely.  I haven't figured out what's going on.  

    I'll continue testing and let you know asap.  Again, thank you!

    Author Comment

    For some reason when using either method, the Visual Basic program runs for a little over a minute and then stops.   I even made an AT command through telnet and it still stops.  But when I run it through the Task scheduler it runs okay.  I then changed the rights for the AT command from "system" to my badge.  It then ran, but this program among other things makes zipped exe files, and these are created in the Windows\system32 directory instead of the directory the program runs from.  Therefore, they don't get copied.  I suppose I could make a conditional statement in the program, but I'd like to avoid that.  I also don't know if I'm going to have problems from changing the AT rights in the Task Scheduler.

    Both of you have given me great ideas though, and I have learned some things from this experience.  I am going to award you both the points and make a new question later that addresses just this one remaining problem.  Thank you both for your outstanding help!!

    Author Comment

    Just a note to let you know I entered another 500 point question for the remote start problem I'm having.  It's in the Windows 2000 area entitled "Problem starting VB program with telnet & psexec"  Thank you for looking at it!

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    755 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

    18 Experts available now in Live!

    Get 1:1 Help Now