As part of an ntbackup script i began recently, I needed to look at how to schedule tasks from remotely. I had some experience using at.exe but seeing as schtasks seems to be the new tool i decided to give it a lash.
Almost immediately i ran into problems, if i was to specify a username and password for the job to run as, the script demanded a system name… why ask for a system name if you want to run it locally i wondered, but with using the %computername% variable it allowed me to run this locally.
schtasks /create /s %computername% /u domainusername /p Password /tn Server-Backup /tr “c:backup.bat” /sc daily /st 09:00:00
the above schedules backup.bat to run as whatever user you specify, it will display as “Server-Backup” in scheduled tasks and will run daily for ever.
Below is an example of what you should see in scheduled tasks:
Check the next post for information on how to roll this out to multiple servers.