Page 1 of 1

[SOLVED] Creating a "Schedule task" other than "daily"

Published: November 16, 2016 - 6:03 PM
by Aguay
Hello everyone.

I'd like to create a PatchCleaner package (http://www.homedev.com.au/free/patchcleaner).
It's software that cleans up Windows updates, which is quite useful for freeing up hard drive space.

It has a CLI that allows you to run the cleanup in "quiet" mode.
I wanted to use setuphelpers to create a scheduled task, but it seems there's no option to create a weekly task instead of a daily one.

So I was wondering if there's a workaround in the works, or if the only way for me is to use "shell_launch"/"run" or something similar with the Windows command "sc".

Thanks in advance ;)

Re: Creating a "Schedule task" other than "daily"

Published: November 16, 2016 - 6:30 PM
by Floflobel
Good morning,

I restart the workstations every day, here is a small example.

Python:

Code: Select all

run(r'schtasks.exe /create /tn "reboot" /xml "%tmp%\reboot.xml" /f')
To create the XML file, I created a scheduled task on a test machine and exported it.

Sincerely,

Re: Creating a "Schedule task" other than "daily"

Published: November 16, 2016 - 6:40 PM
by sfonteneau
Hi Aguay

From Windows 7 onwards only:

I think the best way is to use Windows XML files

You create your task manually on your Windows computer, then you export it
Then you can install the task with this kind of command

Code: Select all

run('schtasks /Create /TN "shutdown_windows" /RU SYSTEM /xml shutdown_windows.xml')
This will allow you to have all the precision of scheduled tasks in Windows 7

Re: Creating a "Schedule task" other than "daily"

Published: November 17, 2016 - 10:45 AM
by Aguay
Thanks for your replies!

So yes, I do need to use the Windows tools. ;)

And thanks to both of you for the example!