BlazeLondon Posted March 15, 2006 Share Posted March 15, 2006 I did not realise creating a scheduled task would be so difficult. Nobody here has had an answer and there is nothing in the AutoIT docs about this.2 days looking on the net didnt gather much either.Calling the AT command is no good as the task is only created with the SYSTEM account - no network access Making AT call a batch file and use RUNAS to start the task with different credentials results in Access Denied!Using schtasks is only any use on xp/2003 or newer.....So it's a dilema.I finally found the solution with an old NT 4 resource kit file called JT.EXEYou can download it here. ftp://ftp.microsoft.com/reskit/win2000/jt.zipIts a bitch to work out the command line syntax so i've done it for you.In AutoITcreate your gui screen that asks fortime to run the task (i used two pull down menus one for hours one for mins)days to run (i used 7 tick boxes for mon - fri)username & password (two input boxes)Then once you have gathered the info you want it looks like this(for each checkbox say $monday=m, $tuesday=t etc)$filename=yourjobname ; the name of the c:\windows\tasks\xxx.job file (without the .job extension)$authu = username$authp = password$time = $list1 & ":" & $list2 (the two list boxes you populated with numbers for hours & mins)$jtdays = $monday & $tuesday & $wednesday etc ; this gives jtdays the format "mtw"then call this with jt.exe in your scriptdirRunWait(@comspec & ' /c ' & 'jt.exe' & ' /saj ' & chr(34) & $filename & '.job' & chr(34) & ' /sc ' & $authu & ' ' & $authp & ' /ctj StartTime=' & $time & ' Type=Weekly TypeArguments=1,' & $jtdays & ' Disabled=0' & ' /sj ApplicationName=' & chr(34) & @scriptdir & '\yourscript.exe' & chr(34) & ' WorkingDirectory=' & chr(34) & @scriptdir & chr(34), @scriptdir, @SW_HIDE )you can like I did add your own error detection routines around this.job done (i hope)Now if I could only work out the command for JT to run the scheduled task with the "Wake computer" option ticked Link to comment Share on other sites More sharing options...
Xenobiologist Posted March 16, 2006 Share Posted March 16, 2006 Hi, seems to be there is someone quite happy getting it work after all. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
blindwig Posted March 16, 2006 Share Posted March 16, 2006 I've used AT and SCHTASKS extensively. Both have their limits (AT is very limited, and SCHTASKS cannot create multi-schedule events) so when I cannot create a task using one of those tools, I just create the task file directly. Tasks are .job files in C:\Windows\Tasks. Create a few tasks, study the .job files to learn the format, and then you can create your own tasks. QED My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
ChrisL Posted March 16, 2006 Share Posted March 16, 2006 I've used AT and SCHTASKS extensively. Both have their limits (AT is very limited, and SCHTASKS cannot create multi-schedule events) so when I cannot create a task using one of those tools, I just create the task file directly.Tasks are .job files in C:\Windows\Tasks. Create a few tasks, study the .job files to learn the format, and then you can create your own tasks. QEDReally??If I open a job file I get.. Û€5ÔwÄA¥ñQ˜`°GüF ˜ < s €! c : \ b a c k u p . c m d c : C h r i s L a m b e r t 0 Ö > [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
blindwig Posted March 28, 2006 Share Posted March 28, 2006 Really??If I open a job file I get.. Û5ÔwÄA¥ñQ`°GüF < s ! c : \ b a c k u p . c m d c : C h r i s L a m b e r t 0 Ö >Yes, it's a binary file - you can't really get anything useful out of it if you display it as ASCII.What I meant was create a scheduled task (using the GUI, if that's easier for you). Now make a copy of that job, like call it task2.job if the first one is task1.job. Now go in and make some small change to the task (like change the scheduled time by 1 minute) and save it. Now use a file comparison utility to campare the 2 files. Where ever the difference is, then you know that's where it stores that information (the scheduled minute, in this case). Keep doing that and pretty soon you'll have the whole job file figured out. Use that knowledge to create a job file on your own (from scratch) or the easier way (the way I do it) is create a basic task with SCHTASKS, then edit the file to make the changes that you couldn't do through SCHTASKS. My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
masvil Posted January 10, 2007 Share Posted January 10, 2007 (edited) Calling the AT command is no good as the task is only created with the SYSTEM account - no network access Making AT call a batch file and use RUNAS to start the task with different credentials results in Access Denied!Using schtasks is only any use on xp/2003 or newer.....So it's a dilema.I finally found the solution with an old NT 4 resource kit file called JT.EXEIs there a way to schedule a task running as user without having to input password?From microsoft.com:Tasks run with with permissions of the NT Authority\System account do not require a password and SchTasks.exe does not prompt for one.So I assume that using SchTasks.exe I can only run a task as system. Right?From tj.exe help:The password may also specified as NULL if the account name is set. NULL as a password indicates that the task should be run ONLY if the specified user is logged on at the time the task is set to execute. Users may create tasks of this type only for themselves. Administrators may create them for any user.It gave me a wish, but"/sc @UserName NULL" command doesn't make start task at all even if I launch task from same account I used to create task. I really can't understand what "if the account name is set" means Edited January 10, 2007 by masvil Link to comment Share on other sites More sharing options...
Proph Posted January 23, 2007 Share Posted January 23, 2007 Is it possible to use jt.exe to run a task with parameters? Like: "C:\mytask.exe" /P I couldn't figure out a way to do it. BTW... with JT.exe can gui based tasks work as well even if the user is not logged in? Or Tasks that use autoit to click on certain gui buttons? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now