hanoi_girl
07-10-2002, 08:23 PM
These are steps to confugure the windows 2000 task scheduler. You don't have to buy backup software.
Creating Windows 2000 Scheduled Backups
Scheduling a backup for Windows 2000 Server is a longwinded process, especially compared to NT 4. One of the major reasons for the new, complicated backup program shipping with Windows 2000 is the requirement of compatibility with DLT Auto Loaders and media libraries. In case you dont have complexity or expensive hardware. To enable a simple, single tape scheduled backup each night follow the following steps.
Step 1:
Create a backup user account (optional). Use this account or whichever account you log in with to create any schedules and any scripts. Create a script folder (something like c:\scripts) and apply appropriate permissions so only you have access to it.
Step 2:
If you have the Windows 2000 Server Resource Kit, you are in luck. If not there is a workaround. Create a backup batch file. Put the following in the batch file:
rsm refresh /lf"Friendly name of tape drive"
sleep 30
ntbackup backup "@c:\scripts\backup.bks" /j "name of backup" /p "4mm DDS" /v:yes /m normal /hc:on /um
rsm eject /pf“name of backup – 1” /astart
Explanation:
The first line refreshes the RSM (Removable Storage Manager) Database. This will allow Backup to recognize the tape in the drive. The "Friendly name of tape drive" is acquired by opening up a command prompt and typing:
rsm view /tlibrary
This will list your tape drive and any other removable storage devices. Highlight the relevant tape drive name and copy paste it into your batch file. Make sure there are no spaces in between the switch and the inverted commas.
The second line uses the sleep utility off the Resource Kit. (If you don’t have the Resource kit, see below) This is simply to make sure that tape drive is recognized and ready to go when the backup script executes.
The third line is the backup script. There are a number of switches, which are required to make it work.
ntbackup backup – This specifies to the backup program you wish to backup
"@c:\scripts\backup.bks" - This specifies the file with the details of what directories you wish to backup. It is a text file (create it using Notepad), simply add in what drives and directories you wish to backup, in the following format:
d:\ - will backup all of D: drive
c:\inetpub\ - will backup the inetpub directory on C: drive
(OR highlight /select the files you require backed up then ‘save as’ c:\scripts\backup.bks)
/j "name of backup" – You can name the backup anything you like. There are a number of scripts on the web that use variables to insert the current date and time, but I found these verbose and unnecessary. If I want to check the backup tapes, the tap[e is labeled in the backup program anyway.
/p "4mm DDS" – This switch specifies what media pool to use. If you are using something other than 4mm DDS drives, you will have to look in your Removable Storage Manager to see what to put in here.
/v:yes – Verify after the backup is complete
/m normal – Specify a normal or incremental backup. I use normal across the board. Better to be safe than sorry.
/hc:on – Hardware compression ON.
/um – This switch will search from the specified media pool (/p "4mm DDS" ) and FORMAT the media when it has found a suitable form of media. Be aware that whatever was on the tape will disappear completely and be replaced by a completely new backup. I would highly recommend that if you use this switch, you check your backups at least once a week to ensure the backup is working. Should go without saying, but you should do a restore once every now and then to verify you can restore the files properly.
This is about as simple as a batch file can get for Windows 2000 Backup, there are still steps to perform to make sure it all comes together and works properly.
rsm eject /pf“name of backup – 1” /astart
This is a simple line to eject the tape once finished. The name of backup is the name you specified in the previous line of the backup script. The – 1 is part of the Physical Media name. To get the physical media name open a command prompt. From the command line, type:
rsm view /tphysical_media
This will give ouput similar to:
c:\>rsm view /tphysial_media
PHYSICAL_MEDIA
backup – 1
The command completed successfully.
In my backup scripts I simply name the tape backup, which means when I view the physical media library, the tape name backup – 1 is returned. You will have one entry PER tape, so if you use five tapes, and you name each tape backup, you will have a list of tapes in your physical media library like below:
c:\>rsm view /tphysial_media
PHYSICAL_MEDIA
backup – 1
backup – 1
backup – 1
backup – 1
backup – 1
There are two work arounds. You could write an elaborate script that extracts the date and time from your system and inserts them into the name of the tape, similar to the tape backup script on the Microsoft website. Alternatively, and probably a whole lot more sensible and functional, is to have a backup script for each day, with the day as the name of the tape.
Step 3:
If you are running a Windows 2000 member server in an NT 4 domain open up User Manager for Domains. Select from the drop down menus the Policies option. Click User Rights. Click the Show Advanced User Rights. Select from the drop down list the following user rights:
Log on as a service
Log on as a batch job
Add in the user account you created to perform backups to both of these user rights. This ensures they can execute scheduled batch jobs and also start the Ntbackup service.
If you are running an Active Directory Services Windows 2000 Domain Controller, you will need to open up the Local Group Policy Editor MMC. Click the Start button, select Run and type:
gpedit.msc
Hit enter and you will be presented with the Group Policy Editor. Select the following:
Computer Configuration -> Windows Settings -> Security Settings -> User Rights Assignments
The two User Rights are listed as above, simply double click on the two user rights, and again add in the user you created to perform the backup.
Step 4:
Create a scheduled task to perform the backup. Simply open up the Scheduled Tasks from My Computer and create a new schedule. Browse through the file system to select your batch file and set a weekly schedule for the backup. Specify the user account and type in their password (twice) and everything should be done.
Make sure you test this thoroughly, as there are mixed reports of this solution working. I have successfully implemented it two sites.
For those with out the Resource Kit:
Split your batch file into two. The first batch file has the following line:
rsm refresh /lf"Friendly name of tape drive"
Create a schedule for this batch file. The second batch file has the following line:
ntbackup backup "@c:\scripts\backup.bks" /j "name of backup" /p "4mm DDS" /v:yes /m normal /hc:on /um
rsm eject /pf”name of backup – 1” /astart
Create a separate schedule for this batch file to run something like 2-3 minutes later than the first task. You will have got around the sleep utility requirement.
Creating Windows 2000 Scheduled Backups
Scheduling a backup for Windows 2000 Server is a longwinded process, especially compared to NT 4. One of the major reasons for the new, complicated backup program shipping with Windows 2000 is the requirement of compatibility with DLT Auto Loaders and media libraries. In case you dont have complexity or expensive hardware. To enable a simple, single tape scheduled backup each night follow the following steps.
Step 1:
Create a backup user account (optional). Use this account or whichever account you log in with to create any schedules and any scripts. Create a script folder (something like c:\scripts) and apply appropriate permissions so only you have access to it.
Step 2:
If you have the Windows 2000 Server Resource Kit, you are in luck. If not there is a workaround. Create a backup batch file. Put the following in the batch file:
rsm refresh /lf"Friendly name of tape drive"
sleep 30
ntbackup backup "@c:\scripts\backup.bks" /j "name of backup" /p "4mm DDS" /v:yes /m normal /hc:on /um
rsm eject /pf“name of backup – 1” /astart
Explanation:
The first line refreshes the RSM (Removable Storage Manager) Database. This will allow Backup to recognize the tape in the drive. The "Friendly name of tape drive" is acquired by opening up a command prompt and typing:
rsm view /tlibrary
This will list your tape drive and any other removable storage devices. Highlight the relevant tape drive name and copy paste it into your batch file. Make sure there are no spaces in between the switch and the inverted commas.
The second line uses the sleep utility off the Resource Kit. (If you don’t have the Resource kit, see below) This is simply to make sure that tape drive is recognized and ready to go when the backup script executes.
The third line is the backup script. There are a number of switches, which are required to make it work.
ntbackup backup – This specifies to the backup program you wish to backup
"@c:\scripts\backup.bks" - This specifies the file with the details of what directories you wish to backup. It is a text file (create it using Notepad), simply add in what drives and directories you wish to backup, in the following format:
d:\ - will backup all of D: drive
c:\inetpub\ - will backup the inetpub directory on C: drive
(OR highlight /select the files you require backed up then ‘save as’ c:\scripts\backup.bks)
/j "name of backup" – You can name the backup anything you like. There are a number of scripts on the web that use variables to insert the current date and time, but I found these verbose and unnecessary. If I want to check the backup tapes, the tap[e is labeled in the backup program anyway.
/p "4mm DDS" – This switch specifies what media pool to use. If you are using something other than 4mm DDS drives, you will have to look in your Removable Storage Manager to see what to put in here.
/v:yes – Verify after the backup is complete
/m normal – Specify a normal or incremental backup. I use normal across the board. Better to be safe than sorry.
/hc:on – Hardware compression ON.
/um – This switch will search from the specified media pool (/p "4mm DDS" ) and FORMAT the media when it has found a suitable form of media. Be aware that whatever was on the tape will disappear completely and be replaced by a completely new backup. I would highly recommend that if you use this switch, you check your backups at least once a week to ensure the backup is working. Should go without saying, but you should do a restore once every now and then to verify you can restore the files properly.
This is about as simple as a batch file can get for Windows 2000 Backup, there are still steps to perform to make sure it all comes together and works properly.
rsm eject /pf“name of backup – 1” /astart
This is a simple line to eject the tape once finished. The name of backup is the name you specified in the previous line of the backup script. The – 1 is part of the Physical Media name. To get the physical media name open a command prompt. From the command line, type:
rsm view /tphysical_media
This will give ouput similar to:
c:\>rsm view /tphysial_media
PHYSICAL_MEDIA
backup – 1
The command completed successfully.
In my backup scripts I simply name the tape backup, which means when I view the physical media library, the tape name backup – 1 is returned. You will have one entry PER tape, so if you use five tapes, and you name each tape backup, you will have a list of tapes in your physical media library like below:
c:\>rsm view /tphysial_media
PHYSICAL_MEDIA
backup – 1
backup – 1
backup – 1
backup – 1
backup – 1
There are two work arounds. You could write an elaborate script that extracts the date and time from your system and inserts them into the name of the tape, similar to the tape backup script on the Microsoft website. Alternatively, and probably a whole lot more sensible and functional, is to have a backup script for each day, with the day as the name of the tape.
Step 3:
If you are running a Windows 2000 member server in an NT 4 domain open up User Manager for Domains. Select from the drop down menus the Policies option. Click User Rights. Click the Show Advanced User Rights. Select from the drop down list the following user rights:
Log on as a service
Log on as a batch job
Add in the user account you created to perform backups to both of these user rights. This ensures they can execute scheduled batch jobs and also start the Ntbackup service.
If you are running an Active Directory Services Windows 2000 Domain Controller, you will need to open up the Local Group Policy Editor MMC. Click the Start button, select Run and type:
gpedit.msc
Hit enter and you will be presented with the Group Policy Editor. Select the following:
Computer Configuration -> Windows Settings -> Security Settings -> User Rights Assignments
The two User Rights are listed as above, simply double click on the two user rights, and again add in the user you created to perform the backup.
Step 4:
Create a scheduled task to perform the backup. Simply open up the Scheduled Tasks from My Computer and create a new schedule. Browse through the file system to select your batch file and set a weekly schedule for the backup. Specify the user account and type in their password (twice) and everything should be done.
Make sure you test this thoroughly, as there are mixed reports of this solution working. I have successfully implemented it two sites.
For those with out the Resource Kit:
Split your batch file into two. The first batch file has the following line:
rsm refresh /lf"Friendly name of tape drive"
Create a schedule for this batch file. The second batch file has the following line:
ntbackup backup "@c:\scripts\backup.bks" /j "name of backup" /p "4mm DDS" /v:yes /m normal /hc:on /um
rsm eject /pf”name of backup – 1” /astart
Create a separate schedule for this batch file to run something like 2-3 minutes later than the first task. You will have got around the sleep utility requirement.