Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using VB to submit scheduled tasks (AT)

Status
Not open for further replies.

Levi_imported

IS-IT--Management
Oct 26, 2000
24
GB
I hope that someone can / is willing to help.....

I have a batch file that is used to submit a scheduled task using the AT command under NT / W2K. My aim is to have a VB application that performs the same function, but alas my VB knowledge is 'a tad limited'

Here is the batch file, which is invoked from the command line like so: C:\>submitat PC001 (where pc001) is the relevant computer name

@ECHO OFF
COLOR 17
ECHO View AT jobs on %1 ...
AT %1
ECHO.
ECHO Submit hourly syncronisation jobs to AT scheduler...
ECHO.
AT %1 0:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 1:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 2:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 3:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 4:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 5:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 6:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 7:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 8:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 9:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 10:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 11:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 12:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 13:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 14:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 15:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 16:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 17:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 18:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 19:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 20:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 21:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 22:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
AT %1 23:00 /every:M,T,W,Th,F,S,Su NET TIME \\SMIPS011 /SET /Y
ECHO.
ECHO View AT jobs on %1 ...
AT %1
ECHO.
ECHO. Done!
PAUSE

To get me started on the creation of my little VB app, can anyone either point me in the direction of the commands used to run a dos command from within a VB application. My intention is to have a form with two text boxes and a 'go' button. the user would then enter the name of the PC in the first box, the name of the time server in the second box and on hitting the 'go' button the application should construct and exectue the respective AT command:

AT <value from input box 1> (the options that I want) NET TIME <value from input box 2> (a few more options)

Any help would be appreciated.
 
OK - So I did a bit more digging and the shell function lets me do what i need to do
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top