Solved

Scheduled tasks backup to tape not working properly.

Posted on 2008-06-19
4
905 Views
Last Modified: 2013-11-29
My question is along the same lines as the one at the bottom which has already been solved.
I am trying to backup to a tape drive via NT Backup.
I have a scheduled Task running. In the scheduled task is the following:

C:\WINDOWS\system32\ntbackup.exe backup "@C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\Backup.bks" /n "Media created 2/20/2008 at 9:47 AM" /d "Set created 2/20/2008 at 9:51 AM" /v:yes /r:no /rs:no /hc:on /m normal /j "Backup" /l:s /p "LTO Ultrium"

This is on a Windows 2003 R2 Server with Exchange 2007.

This runs a previously setup NT Backup file from the server.
I can go into the Scheduled Tasks and run it manually by right clicking and hitting 'RUN'.
That works fine. But when I let the scheduled task run it at 10PM I get this error:

There are two portions of this but it is the same error twice.

----------------------
Backup Status
The requested media failed to mount. The operation was aborted.
----------------------

A manual Backup Report File looks like this:
(There are two portions)

----------------------Beginning of Part 1----------------------
Backup Status
Operation: Backup
Active backup destination: LTO Ultrium
Media name: "BCCORS01-First_Storage_Group-Mailbox_Database"

Volume shadow copy creation: Attempt 1.
Backup of "BCCORS01\Microsoft Information Store\First Storage Group"
Backup set #1 on media #1
Backup description: "BCCORS01-First_Storage_Group-Mailbox_Database"
Media name: "BCCORS01-First_Storage_Group-Mailbox_Database"

Backup Type: Normal

Backup started on 6/19/2008 at 11:06 AM.
Backup completed on 6/19/2008 at 11:35 AM.
Directories: 3
Files: 8
Bytes: 15,780,308,564
Time:  28 minutes and  9 seconds
----------------------End of Part 1 Beginning of Part 2----------------------
NOTE: This company does not use the Public Folders, that is why this is so small and didn't take too long to complete.
Backup Status
Operation: Backup
Active backup destination: LTO Ultrium
Media name: "BCCORS01-Second_Storage_Group-Public_Folder_Database"

Volume shadow copy creation: Attempt 1.
Backup of "BCCORS01\Microsoft Information Store\Second Storage Group"
Backup set #1 on media #1
Backup description: "BCCORS01-Second_Storage_Group-Public_Folder_Databa"
Media name: "BCCORS01-Second_Storage_Group-Public_Folder_Database"

Backup Type: Normal

Backup started on 6/19/2008 at 11:36 AM.
Backup completed on 6/19/2008 at 11:37 AM.
Directories: 3
Files: 3
Bytes: 44,065,530
Time:  18 seconds
----------------------End of Part 2----------------------

Related Question previously solved:
I have a scheduled task set to run every night at 7. The run as is set to Administrator, and the password is correct, the .bat file works when I manually run it, the following services are started, RPC, Task Scheduler, and RunAs Service. And the computer never turns off.  Not sure where to go from here.

The answer to this was changing the network share to a UNC.
Other fixes for issues like this one is user rights.
I am using Administrator.

-Chris
0
Comment
Question by:rcw-it
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
noc-mitts earned 500 total points
ID: 21824897
Try to free the media manually before the backup schedule kicks in. Just open NT backup ... go to restore ... find the tape, right click, free media. Let the backup launch by schedule and see what happens.
0
 

Author Comment

by:rcw-it
ID: 21825077
Thanks for the quick reply.
I am also sorry about this. I had a different scheduled task open and copied the command down off that one. The REAL command in the scheduled task is:

C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -command "c:\util\Backup-Databases.ps1"

The code I have attached is what runs the backup.

I got the code from a Nick Smith website. Just to quote the source.

I have just freed the media and set the backup for 2 minutes from now.
I will let you know how it turns out.
Thanks.


function perform_backup ([string] $ServerName, [string] $BackupRootDrive) {
 
	### Start User Defined Variables ###
	#Set the backup file paths
	$BackupScriptPath = $BackupRootDrive + "BackupFiles\"
	$BackupPath = $BackupRootDrive + "DailyBackups\"
 
	#Set email options
	$EmailReportTo = "techsupport@domain.com"
	$EmailReportFromAddress = "admnistrator@domain.com"
	$EmailSMTPServer = "localhost"
 
	$BackupLog = $BackupScriptPath + "ExchangeBackupLogs.log"
 
	### End User Defined Variables ###
 
	#Create an empty backup log file
	new-item $BackupLog -type file -force 
 
	#Add registry keys to enhance NTBackup performance
	New-ItemProperty -Path:"HKCU:Software\Microsoft\Ntbackup\Backup Engine" -Name:"Logical Disk Buffer Size" -Value:"64" -PropertyType:"String" -Force
	New-ItemProperty -Path:"HKCU:Software\Microsoft\Ntbackup\Backup Engine" -Name:"Max Buffer Size" -Value:"1024" -PropertyType:"String" -Force
	New-ItemProperty -Path:"HKCU:Software\Microsoft\Ntbackup\Backup Engine" -Name:"Max Num Tape Buffers" -Value:"16" -PropertyType:"String" -Force
 
	Get-MailboxDatabase -Server:$ServerName | foreach{
 
		#Create the backup JET file for NTBackup
		$JetBackupSyntax = "JET " + $_.ServerName + "\Microsoft Information Store\" + $_.StorageGroupName + "\" + $_.AdminDisplayName + "`n"
		$BksFileName = $BackupScriptPath + $_.ServerName + "" + $_.StorageGroupName + "" + $_.AdminDisplayName + ".bks"
		$JetBackupSyntax | out-file -filepath $BksFileName -encoding unicode
 
		#Call NTBackup to backup the database
		$BksDescriptiveName = $_.ServerName + "-" + $_.StorageGroupName.Replace(" ","_") + "-" + $_.AdminDisplayName.Replace(" ","_")
		&cmd /c "C:\WINDOWS\system32\ntbackup.exe backup `"@$BksFileName`" /n $BksDescriptiveName /d $BksDescriptiveName /v:no /r:no /rs:no /hc:on /m normal /j `"$BksDescriptiveName`" /l:s /P 'LTO Ultrium' /um"
 
		#Append database backup log to server backup log
		&type (get-childitem "$Home\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\" | Sort -Property:LastWriteTime -Descending)[0].FullName >> $BackupLog
	}
	Get-PublicFolderDatabase -Server:$ServerName | foreach{
 
		#Create the backup JET file for NTBackup
		$JetBackupSyntax = "JET " + $_.ServerName + "\Microsoft Information Store\" + $_.StorageGroupName + "\" + $_.AdminDisplayName + "`n"
		$BksFileName = $BackupScriptPath + $_.ServerName + "" + $_.StorageGroupName + "" + $_.AdminDisplayName + ".bks"
		$JetBackupSyntax | out-file -filepath $BksFileName -encoding unicode
 
		#Call NTBackup to backup the database
		$BksDescriptiveName = $_.ServerName + "-" + $_.StorageGroupName.Replace(" ","_") + "-" + $_.AdminDisplayName.Replace(" ","_")
		&cmd /c "C:\WINDOWS\system32\ntbackup.exe backup `"@$BksFileName`" /n $BksDescriptiveName /d $BksDescriptiveName /v:no /r:no /rs:no /hc:on /m normal /j `"$BksDescriptiveName`" /l:s /P 'LTO Ultrium' /um"
 
		#Append database backup log to server backup log
		&type (get-childitem "$Home\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\" | Sort -Property:LastWriteTime -Descending)[0].FullName >> $BackupLog
	}
	
	#Add line breaks to format the backup log
	$BackupLogFormatted = ""
	Get-Content $BackupLog | foreach { $BackupLogFormatted += $_ + "`n" }
 
	#Email the backup log
	#$smtp = New-Object Net.Mail.SmtpClient -arg $EmailSMTPServer 
	#$smtp.Send($EmailReportFromAddress,$EmailReportTo,"Exchange Backup Results for " + $ServerName + ": " + $(Get-Date).ToString('MM/dd/yyyy'),$BackupLogFormatted)
 
}
 
### Start of backup script ###
 
#Define the disk where to store the backup files
$DiskRoot = "E:\"
 
#Perform the backup
perform_backup $env:COMPUTERNAME $DiskRoot

Open in new window

0
 

Author Comment

by:rcw-it
ID: 21825253
Started up and backed up everything.
Thank you very much!

Just another quick question...
The manual start must overwrite because it always works that way.
It doesn't matter if the tape has something on it or not, it will always work.
But the scheduled seems to need to have the media freed before it runs.
In the code, I assumed that the -force would overwrite but I may be mistaken.
Is there some way to add that to the script?
0
 
LVL 2

Expert Comment

by:noc-mitts
ID: 21826724
I have the same problem. Sometimes backup media failes to mount. If the tape is new, it always fails to launch by schedule.

On 2000server, the issue was kinda sorted by launching another schedule about 30min before the actual backup launches. This runs the same script but recals a different BKS file which contains only a file or two. But doesn't seem to work always on 2k3serves and there isn't a switch or anything to free the tape from the command line ... or else nothin i know of ...

Do you need a script like that ??? you could write one around a couple of lines long and achieve the same result...

try having a look @ this ... http://support.microsoft.com/kb/814583

its should be easy
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question