Home > Batch Scripting, Microsoft, NT Backup, Scripting > Ntbackup part: 3 Rolling out the job.

Ntbackup part: 3 Rolling out the job.

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 domain\username /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 é.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: