How to do auto arhiving with Windows Task Scheduler in Server 2012 R2

The guide provided by Matomo shows how to do it with Server 2008 and I am not sure how much 2008 differs from 2012 R2, but i tried to follow it exactly and my scheduled task would run for days and throw off many errors. Can someone please please guide me on this. Here is the article they provide for Server 2008: How to Set up Auto-Archiving of Your Reports User Guide - Analytics Platform - Matomo


Posting more threads doesn’t help and just makes it harder to keep an overview on the forum.

Honestly a Windows-expert can probably help you more than a Matomo expert as this is just a matter of executing one PHP script (just as with most PHP applications).

But it would be great if you could post an answer once you have a solution so that people can find it in the future and we can update the guide.