Hello there,
You can try powershell script and task scheduler to achieve this.
The Task Scheduler enables you to automatically perform routine tasks on a chosen computer. The Task Scheduler does so by monitoring whatever criteria you choose (referred to as triggers) and then executing the tasks when those criteria are met.
https://learn.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-start-page
Hope this resolves your Query !!
--If the reply is helpful, please Upvote and Accept it as an answer--