?
Solved

Starting programs, batch files on computer from a different computer

Posted on 2004-11-11
5
Medium Priority
?
207 Views
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!
0
Comment
Question by:psmithphil
  • 3
5 Comments
 
LVL 86

Assisted Solution

by:jkr
jkr earned 1000 total points
ID: 12557387
'PsExec' (http://www.sysinternals.com/ntw2k/freeware/psexec.shtml) can do that:

Usage

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]

computer
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.

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

-a
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"

-c
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.

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

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

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

-n
Specifies timeout in seconds connecting to remote computers.

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

-s
Run remote process in the System account .

-u
Specifies optional user name for login to remote computer.

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

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

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

program
Name of the program to execute.

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

(see also http://www.winnetmag.com/Windows/Issues/IssueID/714/Index.html)
0
 
LVL 16

Accepted Solution

by:
JamesDS earned 1000 total points
ID: 12557712
psmithphil
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.

Cheers

JamesDS
0
 

Author Comment

by:psmithphil
ID: 12558939
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!
0
 

Author Comment

by:psmithphil
ID: 12569232
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!!
0
 

Author Comment

by:psmithphil
ID: 12570385
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!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Last month Marc Laliberte, WatchGuard’s Senior Threat Analyst, contributed reviewed the three major email authentication anti-phishing technology standards: SPF, DKIM, and DMARC. Learn more in part 2 of the series originally posted in Cyber Defense …
Screencast - Getting to Know the Pipeline
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

809 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