0

So I have been trying to run robocopy in silent mode with task scheduler, however the powershell or bat script would always pop up whenever a new instance is launched with task scheduler. I found a work around to run infinite loop of the robocopy and then sleep for 24 hours. Since the same session would be active so using windowstyle hidden would keep it minimized. This is supposed to run on production test computers which would be up and running 24 hours and a day for 360+ days an year powered on except some maintenance of renewing cybersecurity certificates or some downtime.

3
  • What sort of error handling to deal with situations where the script breaks? Running as a scheduled task means the task is refreshed each iteration, and if it fails once, it starts back fresh next time. I've done similar things, and using tasks was far superior, particularly in it's resiliency. Commented Dec 4, 2023 at 0:23
  • However note that your question is specifically asking for opinions, and this site doesn't do opinion. I suggest you try to solve your "not running hidden" issue, and we can probably help you figure that out if you edit your question to make it about that. Commented Dec 4, 2023 at 0:24
  • Sounds like you're just doing some kind of backup. I bet Free File Sync will do exactly what you want, without a script. Or something like Veeam, or other backup software.
    – LPChip
    Commented Dec 4, 2023 at 8:03

1 Answer 1

1

A script running 24/7 in an infinite loop is not a good idea.

Although it will probably work, once your script hangs for an unknown reason, it terminates and it stops working. You won't know that it stopped working, and before you realize it, the task has not been run for a week or more.

Given that you talk about robocopy, it is likely that you are copying files, which sounds like a backup.

Taskscheduler is still a better way to go, but you should configure it differently so that the user does not get bothered by it. You can configure the task such that it is completely hidden, but that also gives you the risk that the task can fail to start and you don't notice this in time.

It is therefor recommended to use backup software. This can be Free File Sync or something like veeam. When they run, they run silently in the background, but a tray icon shows that they're working. In addition, they'll keep a log of when they ran and if there was any error, which can be checked periodically if necessary. A true backup solution such as veeam also has the option to email failures.

Not the answer you're looking for? Browse other questions tagged .