troubleshooting Question

Windows SCHTASKS command line scheduler: create if task doesn't exist?

Avatar of bemara57
bemara57 asked on
Windows Batch
1 Comment1 Solution8813 ViewsLast Modified:
I have a scheduled task in a batch file like this:

SCHTASKS /CREATE /SC DAILY /ST 03:30:00 /TN "MySQL Backup" /TR %SCRIPTPATH%\Backup_MySQL.cmd /RU "NT AUTHORITY\SYSTEM"

Because I move this script from server to server, is there a way to first check if this task exists, then:

1.) If it does exist, to update the time of the scheduled task in case the time was changed in the batch script?
2.) If it doesn't then create it?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros