dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Normally takes in a backuphistory object from Format-DbaBackupInformation.

This is then parse to check that it’s valid for restore. Tests performed include:
      Checking unbroken LSN chain
      if the target database exists and WithReplace has been provided
      if any files already exist, but owned by other databases
      Creates any new folders required
      That the backupfiles exists at the location specified, and can be seen by the Sql Instance

If no errors are found then the objects for that database will me marked as Verified.




Pass in a BackupHistory object to be tested against MyInstance.

Those records that pass are marked as verified. We can then use the IsVerified property to divide the failures and successes.

$BackupHistory | Test-DbaBackupInformation -SqlInstance MyInstance

$PassedDbs = $BackupHistory | Where-Object {$.IsVerified -eq $True}
$FailedDbs = $BackupHistory | Where-Object {$
.IsVerified -ne $True}


This command was created by Stuart Moore. You can find Stuart on Twitter and his blog.


From PowerShell, execute Get-Help Test-DbaBackupInformation -Detailed for more information on this function.

Source Code

Want to see the source code? View Test-DbaBackupInformation.ps1 on GitHub

Related commands