Sign in to follow this  
Followers 0
kiboost

window 7 task scheduler

7 posts in this topic

#1 ·  Posted (edited)

Hi,

I would like to check, clean, identify and delete or modify some tasks, adding some task to run some of my script as a task etc, all with an autoit script.

I have never, ever, used task scheduler, I understand how it works but I would need some informations on how to do this by script. An autoit UDF, or some cmd to run/shellexecute etc, any help will ... help !

Thks

Kib

Edited by kiboost

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Share this post


Link to post
Share on other sites



Thanks, was looking for an integrated UDF, there is one on the forum but not optimal. Will use the old cmd method ;-)


Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Share this post


Link to post
Share on other sites

There is some code related to the COM object "Schedule.Service" on the German Autoit forum:

http://autoit.de/index.php?page=Thread&threadID=25383

Share this post


Link to post
Share on other sites

hmm I dunno german at all so hard to see if it works, will try to test it.

Anyway, on the cmd version, I can't delete a task as it ask for confirmation and I can't find a switch to not ask this confirmation.

actually I query all task :

$command = 'schtasks /query'

$ReadCmd = Run($command, @ScriptDir, @SW_HIDE, 2)

While 1

$return &= StdoutRead($ReadCmd)

If @error Then ExitLoop

WEnd

then I find taskname that interest me and finnally :

$command = 'schtasks /Delete /TN "'&$taskname&'"'

RunAs($Loginadmin, @ComputerName, $Passadmin, 0, $command, @SystemDir, @SW_HIDE)

but it doesn't delete the task, and when doing it manually in a cmd prompt I have the confirmation asked.

Any idea ?


Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Share this post


Link to post
Share on other sites

ok found : $command = 'schtasks /Delete /TN "'&$taskname&'" /F'


Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0