In the previous two articles I have covered off how to backup your servers to one file share and script a scheduled task to automate the process. Now what we have to do is copy the backup.bat out to each C: drive of every server, and create our scheduled task on each server.
There are many reasons I have decided to do this process manually. Leaving the backup.bat on the c: drive will allow for easy maintenance of the backups on each server for adding/removing backups. The second reason is the servers you wish to backup will need different drives backed up!
Once you have copied the custom backup.bat to the c drive of all your servers its now time to schedule the task…this is a simple and painless script that can also be reverse engineered to delete the job.
Place all your server names in a text file called servers.txt one per line and place it to the c: drive root e.g. c:. Once created, kick off a CMD prompt as a user with admin rights on the servers.
Now using the for command:
FOR /F “tokens=* delims=: ” %%i in (c:servers.txt) do schtasks /create /s %%i /u domainusername /p password /tn Server-Backup /tr “c:backup.bat” /sc daily /st 19:00:00
This will contact each server, one by one, and create your schedueled task to run every day at 7pm. Make sure to change the domain username and password to match your own environment.
Agus sin é.