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

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
User avatar
Aguay
Messages: 27
Registration: May 22, 2015 - 4:20 p.m.

November 16, 2016 - 6:03 PM

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 ;)
Floflobel
Messages: 135
Registration: Oct 15, 2015 - 5:32 p.m.

November 16, 2016 - 6:30 PM

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,
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

November 16, 2016 - 6:40 PM

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
User avatar
Aguay
Messages: 27
Registration: May 22, 2015 - 4:20 p.m.

November 17, 2016 - 10:45 AM

Thanks for your replies!

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

And thanks to both of you for the example!
Locked